Documentation
¶
Index ¶
- func CustomCapitalLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func CustomColorCapitalLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func CustomTimeEncoder(time time.Time, encoder zapcore.PrimitiveArrayEncoder)
- func NewLogger(config *Config, options ...Option) *zap.Logger
- func NewLumberjackUrl(config *LumberjackConfig) string
- func NewRotateLogURL(config *RotateLogConfig) string
- func NewSugaredLogger(config *Config, options ...Option) *zap.SugaredLogger
- type Config
- type LumberjackConfig
- type Option
- func WithConsoleConfig(config zapcore.EncoderConfig) Option
- func WithConsoleFormat() Option
- func WithConsoleOutPut() Option
- func WithFileConfig(config zapcore.EncoderConfig) Option
- func WithFileOutPut() Option
- func WithJSONFormat() Option
- func WithLumberjack(config *LumberjackConfig) Option
- func WithRotateLog(config *RotateLogConfig) Option
- func WithZaplogfmtFormat() Option
- type RotateLogConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomCapitalLevelEncoder ¶
func CustomCapitalLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
func CustomColorCapitalLevelEncoder ¶
func CustomColorCapitalLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
func CustomTimeEncoder ¶
func CustomTimeEncoder(time time.Time, encoder zapcore.PrimitiveArrayEncoder)
func NewLumberjackUrl ¶
func NewLumberjackUrl(config *LumberjackConfig) string
func NewRotateLogURL ¶
func NewRotateLogURL(config *RotateLogConfig) string
func NewSugaredLogger ¶
func NewSugaredLogger(config *Config, options ...Option) *zap.SugaredLogger
Types ¶
type LumberjackConfig ¶
type LumberjackConfig struct { // 文件名 FileName string `json:"fileName"` // MaxSize is the maximum size in megabytes of the log file before it gets // rotated. It defaults to 100 megabytes. MaxSize int `json:"maxSize"` // MaxBackups is the maximum number of old log files to retain. The default // is to retain all old log files (though MaxAge may still cause them to get // deleted.) MaxBackups int `json:"maxBackups"` // MaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is not to remove old log files // based on age. MaxAge int `json:"maxAge"` // Compress determines if the rotated log files should be compressed // using gzip. The default is not to perform compression. Compress bool `json:"compress"` // LocalTime determines if the time used for formatting the timestamps in // backup files is the computer's local time. The default is to use UTC // time. Localtime bool `json:"localtime"` }
func LumberjackDefaultConfig ¶
func LumberjackDefaultConfig() *LumberjackConfig
func (*LumberjackConfig) String ¶
func (l *LumberjackConfig) String() string
type Option ¶
type Option interface { Name() string Value() interface{} }
func WithConsoleConfig ¶
func WithConsoleConfig(config zapcore.EncoderConfig) Option
func WithConsoleFormat ¶
func WithConsoleFormat() Option
func WithConsoleOutPut ¶
func WithConsoleOutPut() Option
func WithFileConfig ¶
func WithFileConfig(config zapcore.EncoderConfig) Option
func WithFileOutPut ¶
func WithFileOutPut() Option
func WithJSONFormat ¶
func WithJSONFormat() Option
func WithLumberjack ¶
func WithLumberjack(config *LumberjackConfig) Option
func WithRotateLog ¶
func WithRotateLog(config *RotateLogConfig) Option
func WithZaplogfmtFormat ¶
func WithZaplogfmtFormat() Option
type RotateLogConfig ¶
type RotateLogConfig struct { FileName string `json:"fileName,omitempty"` MaxAge string `json:"maxAge,omitempty"` LocalTime bool `json:"localTime,omitempty"` RotationTime string `json:"rotationTime,omitempty"` }
func RotateLogDefaultConfig ¶
func RotateLogDefaultConfig() *RotateLogConfig
func (*RotateLogConfig) String ¶
func (r *RotateLogConfig) String() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.