Documentation ¶
Index ¶
- func DefaultEncoder() zapcore.Encoder
- func DefaultEncoderConfig() zapcore.EncoderConfig
- func DefaultLumberjackLogger() *lumberjack.Logger
- func DefaultOption() []zap.Option
- func MicroServerWrapper(logger *zap.Logger) server.HandlerWrapper
- func NewLogger(plugin zapcore.Core, options ...zap.Option) *zap.Logger
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEncoderConfig ¶
func DefaultEncoderConfig() zapcore.EncoderConfig
func DefaultLumberjackLogger ¶
func DefaultLumberjackLogger() *lumberjack.Logger
DefaultLumberjackLogger 1.不会自动清理backup 2.每200mb压缩一次,不按时间rotate
func DefaultOption ¶
func MicroServerWrapper ¶
func MicroServerWrapper(logger *zap.Logger) server.HandlerWrapper
Types ¶
type Plugin ¶
func NewFilePlugin ¶
NewFilePlugin use lumberjack.Logger writer to new zapcore.Core. lumberjack.Logger虽然持有File,但没有暴露sync方法,所以没办法利用zap的sync特性。 所以额外返回一个closer,需要保证在进程退出前close以保证写入的内容可以全部刷到到磁盘。
func NewPlugin ¶
func NewPlugin(writer zapcore.WriteSyncer, enabler zapcore.LevelEnabler) Plugin
func NewStderrPlugin ¶
func NewStderrPlugin(enabler zapcore.LevelEnabler) Plugin
func NewStdoutPlugin ¶
func NewStdoutPlugin(enabler zapcore.LevelEnabler) Plugin
Click to show internal directories.
Click to hide internal directories.