Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ZapLoggerInitByViper ¶
func ZapLoggerInitByViper() error
ZapLoggerInitByViper init zap logger
viper config example: # zap config zap: AtomicLevel: -1 # DebugLevel:-1 InfoLevel:0 WarnLevel:1 ErrorLevel:2 Api: PrefixPaths: "/api/v1/" # api path prefix list AtomicLevel: 0 # DebugLevel:-1 InfoLevel:0 WarnLevel:1 ErrorLevel:2 default 0 FieldsAuto: false # is use auto Fields key set Fields: Key: key Val: val Development: true # is open file and line number Encoding: console # output format, only use console or json, default is console rotate: Filename: logs/temp-gin-web.log # Log file path # AccessFilename: logs/access.log # Access log file path # ApiFilename: logs/api.log # api log file path MaxSize: 16 # Maximum size of each zlog file, Unit: M MaxBackups: 10 # How many backups are saved in the zlog file MaxAge: 7 # How many days can the file be keep, Unit: day Compress: true # need compress EncoderConfig: TimeKey: time LevelKey: level NameKey: logger CallerKey: caller MessageKey: msg StacktraceKey: stacktrace TimeEncoder: ISO8601TimeEncoder # ISO8601TimeEncoder EpochMillisTimeEncoder EpochNanosTimeEncoder EpochTimeEncoder default is ISO8601TimeEncoder EncodeDuration: SecondsDurationEncoder # NanosDurationEncoder SecondsDurationEncoder StringDurationEncoder default is SecondsDurationEncoder EncodeLevel: CapitalColorLevelEncoder # CapitalLevelEncoder CapitalColorLevelEncoder LowercaseColorLevelEncoder LowercaseLevelEncoder default is CapitalLevelEncoder EncodeCaller: ShortCallerEncoder # ShortCallerEncoder FullCallerEncoder default is FullCallerEncoder
return error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.