Documentation ¶
Index ¶
- Constants
- Variables
- func Alert(f interface{}, v ...interface{})
- func Crit(f interface{}, v ...interface{})
- func Debug(f interface{}, v ...interface{})
- func Emer(f interface{}, v ...interface{})
- func Error(f interface{}, v ...interface{})
- func Fatal(f interface{}, v ...interface{})
- func Info(f interface{}, v ...interface{})
- func Painc(f interface{}, v ...interface{})
- func Register(name string, log Logger)
- func Reset()
- func SetLogPathTrim(trimPath string)
- func SetLogger(param ...string) error
- func Trace(f interface{}, v ...interface{})
- func Version()
- func Warn(f interface{}, v ...interface{})
- type LocalLogger
- func (logs *LocalLogger) Alert(format string, v ...interface{})
- func (logs *LocalLogger) Close()
- func (logs *LocalLogger) Crit(format string, v ...interface{})
- func (logs *LocalLogger) Debug(format string, v ...interface{})
- func (logs *LocalLogger) DelLogger(adapterName string) error
- func (logs *LocalLogger) Emer(format string, v ...interface{})
- func (logs *LocalLogger) Error(format string, v ...interface{})
- func (logs *LocalLogger) Fatal(format string, args ...interface{})
- func (logs *LocalLogger) Info(format string, v ...interface{})
- func (logs *LocalLogger) Panic(format string, args ...interface{})
- func (logs *LocalLogger) Reset()
- func (logs *LocalLogger) SetCallDepth(depth int)
- func (logs *LocalLogger) SetLogPathTrim(trimPath string)
- func (logs *LocalLogger) SetLogger(adapterName string, configs ...string) error
- func (logs *LocalLogger) Trace(format string, v ...interface{})
- func (logs *LocalLogger) Warn(format string, v ...interface{})
- type Logger
Constants ¶
View Source
const ( LevelEmergency = iota // 系统级紧急,比如磁盘出错,内存异常,网络不可用等 LevelAlert // 系统级警告,比如数据库访问异常,配置文件出错等 LevelCritical // 系统级危险,比如权限出错,访问异常等 LevelError // 用户级错误 LevelWarning // 用户级警告 LevelInformational // 用户级信息 LevelDebug // 用户级调试 LevelTrace // 用户级基本输出 )
日志等级,从0-7,日优先级由高到低
View Source
const ( AdapterConsole = "console" // 控制台输出配置项 AdapterFile = "file" // 文件输出配置项 AdapterConn = "conn" // 网络输出配置项 )
Variables ¶
View Source
var LevelMap = map[string]int{ "EMER": LevelEmergency, "ALRT": LevelAlert, "CRIT": LevelCritical, "EROR": LevelError, "WARN": LevelWarning, "INFO": LevelInformational, "DEBG": LevelDebug, "TRAC": LevelTrace, }
日志等级和描述映射关系
Functions ¶
func Fatal ¶
func Fatal(f interface{}, v ...interface{})
Fatal logs a message at emergency level and exit.
func Painc ¶
func Painc(f interface{}, v ...interface{})
Painc logs a message at emergency level and panic.
func SetLogPathTrim ¶
func SetLogPathTrim(trimPath string)
Types ¶
type LocalLogger ¶
type LocalLogger struct {
// contains filtered or unexported fields
}
func NewLogger ¶
func NewLogger(depth ...int) *LocalLogger
func (*LocalLogger) Alert ¶
func (logs *LocalLogger) Alert(format string, v ...interface{})
Alert Log ALERT level message.
func (*LocalLogger) Close ¶
func (logs *LocalLogger) Close()
func (*LocalLogger) Crit ¶
func (logs *LocalLogger) Crit(format string, v ...interface{})
Crit Log CRITICAL level message.
func (*LocalLogger) Debug ¶
func (logs *LocalLogger) Debug(format string, v ...interface{})
Debug Log DEBUG level message.
func (*LocalLogger) DelLogger ¶
func (logs *LocalLogger) DelLogger(adapterName string) error
func (*LocalLogger) Emer ¶
func (logs *LocalLogger) Emer(format string, v ...interface{})
Emer Log EMERGENCY level message.
func (*LocalLogger) Error ¶
func (logs *LocalLogger) Error(format string, v ...interface{})
Error Log ERROR level message.
func (*LocalLogger) Fatal ¶
func (logs *LocalLogger) Fatal(format string, args ...interface{})
func (*LocalLogger) Info ¶
func (logs *LocalLogger) Info(format string, v ...interface{})
Info Log INFO level message.
func (*LocalLogger) Panic ¶
func (logs *LocalLogger) Panic(format string, args ...interface{})
func (*LocalLogger) Reset ¶
func (logs *LocalLogger) Reset()
func (*LocalLogger) SetCallDepth ¶
func (logs *LocalLogger) SetCallDepth(depth int)
func (*LocalLogger) SetLogPathTrim ¶
func (logs *LocalLogger) SetLogPathTrim(trimPath string)
设置日志起始路径
func (*LocalLogger) SetLogger ¶
func (logs *LocalLogger) SetLogger(adapterName string, configs ...string) error
func (*LocalLogger) Trace ¶
func (logs *LocalLogger) Trace(format string, v ...interface{})
Trace Log TRAC level message.
func (*LocalLogger) Warn ¶
func (logs *LocalLogger) Warn(format string, v ...interface{})
Warn Log WARNING level message.
Click to show internal directories.
Click to hide internal directories.