Documentation ¶
Overview ¶
Package logger wrapped zap as a basic logging implement.
Index ¶
Constants ¶
View Source
const ( // 禁用 JSON 形式输出. OPT_ENC_CONSOLE = 1 //nolint:golint,stylecheck // 显示代码路径时,不显示全路径. OPT_SHORT_CALLER = 2 //nolint:stylecheck,golint // 日志写到 stdout. OPT_STDOUT = 4 //nolint:stylecheck,golint // 日志内容中追加颜色. OPT_COLOR = 8 //nolint:stylecheck,golint // 日志自动切割. OPT_ROTATE = 32 //nolint:stylecheck,golint // 默认日志 flags. OPT_DEFAULT = OPT_ENC_CONSOLE | OPT_SHORT_CALLER | OPT_ROTATE //nolint:stylecheck,golint DEBUG = "debug" INFO = "info" WARN = "warn" ERROR = "error" PANIC = "panic" DPANIC = "dpanic" FATAL = "fatal" )
View Source
const ( NameKeyMod = "mod" NameKeyMsg = "msg" NameKeyLevel = "lev" NameKeyTime = "ts" NameKeyPos = "pos" )
View Source
const (
STDOUT = "stdout" // log output to stdout
)
Variables ¶
View Source
var ( MaxSize = 32 // MB MaxBackups = 5 MaxAge = 30 // day )
View Source
var ( SchemeTCP = "tcp" SchemeUDP = "udp" )
View Source
var ( StdoutColor bool StdoutLevel = DEBUG )
Functions ¶
func InitRoot ¶
InitRoot used to setup global root logger, include
- log level
- log path
- set to disk file(with or without rotate)
- set to some remtoe TCP/UDP server
- a bounch of other OPT_XXXs
func SetGlobalRootLogger ¶
SetGlobalRootLogger deprecated, use InitRoot() instead.
func TotalSLoggers ¶
func TotalSLoggers() int64
Types ¶
Click to show internal directories.
Click to hide internal directories.