Documentation ¶
Index ¶
- func ColorDebug(args ...any)
- func ColorDebugf(formatter string, args ...any)
- func ColorError(args ...any)
- func ColorErrorf(formatter string, args ...any)
- func ColorFatal(args ...any)
- func ColorFatalf(formatter string, args ...any)
- func ColorInfo(args ...any)
- func ColorInfof(formatter string, args ...any)
- func ColorWarn(args ...any)
- func ColorWarnf(formatter string, args ...any)
- func Debug(args ...any)
- func DebugFields(msg string, fields ...zap.Field)
- func Debugf(formatter string, args ...any)
- func Error(args ...any)
- func ErrorFields(msg string, fields ...zap.Field)
- func Errorf(formatter string, args ...any)
- func Fatal(args ...any)
- func FatalFields(msg string, fields ...zap.Field)
- func Fatalf(formatter string, args ...any)
- func Info(args ...any)
- func InfoFields(msg string, fields ...zap.Field)
- func Infof(formatter string, args ...any)
- func Sync() error
- func Warn(args ...any)
- func WarnFields(msg string, fields ...zap.Field)
- func Warnf(formatter string, args ...any)
- type Config
- type CoreConfig
- type FormatConfig
- type Logger
- type WriteConfig
- type ZapLogger
- func (z *ZapLogger) Debug(args ...any)
- func (z *ZapLogger) DebugFields(msg string, fields ...zap.Field)
- func (z *ZapLogger) Debugf(formatter string, args ...any)
- func (z *ZapLogger) Error(args ...any)
- func (z *ZapLogger) ErrorFields(msg string, fields ...zap.Field)
- func (z *ZapLogger) Errorf(formatter string, args ...any)
- func (z *ZapLogger) Fatal(args ...any)
- func (z *ZapLogger) FatalFields(msg string, fields ...zap.Field)
- func (z *ZapLogger) Fatalf(formatter string, args ...any)
- func (z *ZapLogger) Info(args ...any)
- func (z *ZapLogger) InfoFields(msg string, fields ...zap.Field)
- func (z *ZapLogger) Infof(formatter string, args ...any)
- func (z *ZapLogger) Sync() error
- func (z *ZapLogger) Warn(args ...any)
- func (z *ZapLogger) WarnFields(msg string, fields ...zap.Field)
- func (z *ZapLogger) Warnf(formatter string, args ...any)
- func (z *ZapLogger) With(fields ...zap.Field) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorDebug ¶ added in v0.7.1
func ColorDebug(args ...any)
func ColorDebugf ¶ added in v0.5.0
func ColorError ¶ added in v0.7.1
func ColorError(args ...any)
func ColorErrorf ¶ added in v0.5.0
func ColorFatal ¶ added in v0.7.1
func ColorFatal(args ...any)
func ColorFatalf ¶ added in v0.5.0
func ColorInfof ¶ added in v0.5.0
func ColorWarnf ¶ added in v0.5.0
func DebugFields ¶ added in v0.5.0
func ErrorFields ¶ added in v0.5.0
func FatalFields ¶ added in v0.5.0
func InfoFields ¶ added in v0.5.0
func WarnFields ¶ added in v0.5.0
Types ¶
type Config ¶ added in v0.6.3
type Config struct { // CallerSkip controls the nesting depth of log function. CallerSkip int `yaml:"caller_skip"` CoreConfig []*CoreConfig `yaml:"core_config"` }
Config is the output config, includes console, file and remote.
type CoreConfig ¶
type CoreConfig struct { // Level controls the log level, like debug, info or error. Level string // Formatter is the format of log, such as console or json. Formatter string FormatConfig *FormatConfig `yaml:"formatter_config"` // Writer is the output of log, such as console or file. Writer string WriteConfig *WriteConfig `yaml:"writer_config"` }
CoreConfig is console, file output config.
type FormatConfig ¶
type FormatConfig struct { // TimeKey is the time key of log output, default as "time". TimeKey string `yaml:"time_key"` // LevelKey is the level key of log output, default as "level". LevelKey string `yaml:"level_key"` // NameKey is the name key of log output, default as "name". NameKey string `yaml:"name_key"` // CallerKey is the caller key of log output, default as "caller". CallerKey string `yaml:"caller_key"` // FunctionKey is the function key of log output, default as "", which means not to print function name. FunctionKey string `yaml:"function_key"` // MessageKey is the message key of log output, default as "msg". MessageKey string `yaml:"message_key"` // StackTraceKey is the stack trace key of log output, default as "", which means not to print stacktrace name. StacktraceKey string `yaml:"stacktrace_key"` }
FormatConfig is the log format config.
type Logger ¶
type Logger interface { With(fields ...zap.Field) Logger Debug(args ...any) Debugf(formatter string, args ...any) DebugFields(msg string, fields ...zap.Field) Info(args ...any) Infof(formatter string, args ...any) InfoFields(msg string, fields ...zap.Field) Warn(args ...any) Warnf(formatter string, args ...any) WarnFields(msg string, fields ...zap.Field) Error(args ...any) Errorf(formatter string, args ...any) ErrorFields(msg string, fields ...zap.Field) Fatal(args ...any) Fatalf(formatter string, args ...any) FatalFields(msg string, fields ...zap.Field) Sync() error }
type WriteConfig ¶
type WriteConfig struct { // FileName is the file name like /var/run/log/server.log. FileName string `yaml:"file_name"` // TimeFormat is the time format to split log file by time. TimeFormat string `yaml:"time_format"` // MaxSize is the max size of log file(MB). MaxSize int `yaml:"max_size"` // MaxBackups is the max backup files. MaxBackups int `yaml:"max_backups"` // MaxAge is the max expire times(day). MaxAge int `yaml:"max_age"` // Compress defines whether log should be compressed. Compress bool `yaml:"compress"` }
WriteConfig is the local file config.
type ZapLogger ¶ added in v0.0.4
type ZapLogger struct {
// contains filtered or unexported fields
}
func (*ZapLogger) DebugFields ¶ added in v0.0.4
func (*ZapLogger) ErrorFields ¶ added in v0.0.4
func (*ZapLogger) FatalFields ¶ added in v0.0.4
func (*ZapLogger) InfoFields ¶ added in v0.0.4
func (*ZapLogger) WarnFields ¶ added in v0.0.4
Click to show internal directories.
Click to hide internal directories.