Documentation
¶
Index ¶
- Variables
- func Debug(args ...interface{})
- func DebugContextf(ctx context.Context, format string, args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func ErrorContextf(ctx context.Context, format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func FatalContextf(ctx context.Context, format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func InfoContextf(ctx context.Context, format string, args ...interface{})
- func Infof(format string, args ...interface{})
- func NewZapLogger(c LocalConfig) *zaplogger
- func Register(name string, logger Logger)
- func SetDefaultLogger(logger Logger)
- func SetLevel(name string, level Level)
- func Sync() error
- func Trace(args ...interface{})
- func TraceContextf(ctx context.Context, format string, args ...interface{})
- func Tracef(format string, args ...interface{})
- func Warn(args ...interface{})
- func WarnContextf(ctx context.Context, format string, args ...interface{})
- func Warnf(format string, args ...interface{})
- func WithContextFields(ctx context.Context, fields ...Field) context.Context
- func WithContextPairs(ctx context.Context, kvs ...string) context.Context
- type Field
- type Level
- type LocalConfig
- type Logger
- type Msg
Constants ¶
This section is empty.
Variables ¶
View Source
var LevelToString = map[Level]string{ LevelTrace: "trace", LevelDebug: "debug", LevelInfo: "info", LevelWarn: "warn", LevelError: "error", LevelFatal: "fatal", }
Functions ¶
func DebugContextf ¶
func ErrorContextf ¶
func FatalContextf ¶
func InfoContextf ¶
func NewZapLogger ¶
func NewZapLogger(c LocalConfig) *zaplogger
func NewZapLogger(file string, level string, isCompress bool) *zaplogger {
func SetDefaultLogger ¶
func SetDefaultLogger(logger Logger)
func TraceContextf ¶
func WarnContextf ¶
func WithContextFields ¶
Types ¶
type LocalConfig ¶
type LocalConfig struct {
//LogPath string `yaml:"log_path" json:"log_path"` // 日志路径
Filename string `yaml:"filename" json:"filename"` // 日志文件名
Level string `yaml:"level" json:"level"` // 日志Level
MaxAge int `yaml:"max_age" json:"max_age"` // 最大超时天数
MaxBackups int `yaml:"max_backups" json:"max_backups"` // 日志最大备份数
Compress bool `yaml:"compress" json:"compress"` // 是否压缩
MaxSize int `yaml:"max_size" json:"max_size"` // 单个日志文件占用空间上限 MB
}
LocalConfig 本地文件配置
type Logger ¶
type Logger interface {
Sync() error
SetLevel(name string, level Level)
GetLevel(name string) Level
With(fields ...Field) Logger
Trace(args ...interface{})
Tracef(format string, args ...interface{})
Debug(args ...interface{})
Debugf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Warn(args ...interface{})
Warnf(format string, args ...interface{})
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
}
func DefaultLogger ¶
func DefaultLogger() Logger
Click to show internal directories.
Click to hide internal directories.