Documentation
¶
Index ¶
- Constants
- func L() *zap.Logger
- func SetLogger(option *LogOption)
- func SetSimpleLogger(format string, filename string, level zapcore.Level)
- type LogOption
- func (l *LogOption) SetFileName(f string) *LogOption
- func (l *LogOption) SetFormat(f string) *LogOption
- func (l *LogOption) SetLevel(level zapcore.Level) *LogOption
- func (l *LogOption) SetMaxAge(days int) *LogOption
- func (l *LogOption) SetMaxBackups(count int) *LogOption
- func (l *LogOption) SetMaxSizeMB(size int) *LogOption
Constants ¶
View Source
const ( // LogFormatJSON means json log LogFormatJSON = "json" // LogFormatConsole means console log LogFormatConsole = "console" // KeyTime is default TimeKey in zapcore.EncoderConfig KeyTime = "time" // KeyLevel is default LevelKey in zapcore.EncoderConfig KeyLevel = "level" // KeyName is default NameKey in zapcore.EncoderConfig KeyName = "logger" // KeyCaller is default CallerKey in zapcore.EncoderConfig KeyCaller = "caller" // KeyMessage is default MessageKey in zapcore.EncoderConfig KeyMessage = "msg" // KeyStackTrace is default StacktraceKey in zapcore.EncoderConfig KeyStackTrace = "stacktrace" // MaxSizeMB is default max size of log file in MB MaxSizeMB = 1 // MaxBackups is default max count of backup log files MaxBackups = 5 // MaxAge is default max age of log file before delete MaxAge = 7 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogOption ¶
type LogOption struct { Format string MaxSizeMB int MaxBackups int MaxAge int Level zapcore.Level FileName string }
LogOption is option struct
func DefaultLogOption ¶
func DefaultLogOption() *LogOption
DefaultLogOption return default LogOption
func (*LogOption) SetFileName ¶
SetFileName set filename of log file
func (*LogOption) SetMaxBackups ¶
SetMaxBackups set max backup count
func (*LogOption) SetMaxSizeMB ¶
SetMaxSizeMB set max size in MB
Click to show internal directories.
Click to hide internal directories.