package log

import (
    "gitlab.dianchu.cc/Taotie/log/field"
    "os"
)
var     DefaultName  = "root"
func init(){
    // 创建默认的 全局 日志调用对象，root
    // 默认配置为 Production
    cfg := NewProductionConfig(os.Stdout)
    cfg.Name = DefaultName
    cfg.ID = DefaultName
    // 一般来说不会失败
    l,_ := New(cfg)

    UpdateGlobalLog(l)
}

// UpdateGlobalLog 更新 全局 默认 logger
func UpdateGlobalLog(l *Logger) {
    Debug = l.Debug
    Info = l.Info
    Warn = l.Warn
    Error = l.Error
    Critical = l.Critical
    Fixed = l.Fixed
    Sync = l.Sync
    With = l.With
}
type logFunc func(msg string, fields ...field.Field)

var Debug func(msg string, fields ...field.Field)
var Info func(msg string, fields ...field.Field)
var Warn func(msg string, fields ...field.Field)
var Error func(msg string, fields ...field.Field)
var Critical func(msg string, fields ...field.Field)
var Fixed func(msg string, fields ...field.Field)

var Sync func() error
var With func(fields ...field.Field) *Logger