Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, msg string, fields ...zap.Field)
- func DebugEnable() bool
- func Debugf(ctx context.Context, template string, args ...interface{})
- func Error(ctx context.Context, msg string, fields ...zap.Field)
- func Errorf(ctx context.Context, template string, args ...interface{})
- func Fatal(ctx context.Context, msg string, fields ...zap.Field)
- func Fatalf(ctx context.Context, template string, args ...interface{})
- func GetRequestID(ctx context.Context) string
- func GetWriter(filename string) io.Writer
- func GetZapLogger() *zap.Logger
- func Info(ctx context.Context, msg string, fields ...zap.Field)
- func Infof(ctx context.Context, template string, args ...interface{})
- func Init(cfg *LoggerCfg) error
- func Warn(ctx context.Context, msg string, fields ...zap.Field)
- func Warnf(ctx context.Context, template string, args ...interface{})
- func WhitIsCompress(isCompress bool) optionFun
- func WhitIsConsole(isConsole bool) optionFun
- func WhitLevel(level string) optionFun
- func WhitLoggingDir(dir string) optionFun
- func WhitMaxAge(maxAge int) optionFun
- func WhitMaxBackup(maxBackup int) optionFun
- func WhitMaxSize(maxSize int) optionFun
- type Logger
- func (m *Logger) Debug(msg string, fields ...zap.Field)
- func (m *Logger) Debugf(template string, args ...interface{})
- func (m *Logger) Error(msg string, fields ...zap.Field)
- func (m *Logger) Errorf(template string, args ...interface{})
- func (m *Logger) Fatal(msg string, fields ...zap.Field)
- func (m *Logger) Fatalf(template string, args ...interface{})
- func (m *Logger) Info(msg string, fields ...zap.Field)
- func (m *Logger) Infof(template string, args ...interface{})
- func (m *Logger) Warn(msg string, fields ...zap.Field)
- func (m *Logger) Warnf(template string, args ...interface{})
- type LoggerCfg
Constants ¶
View Source
const ( XRequestIDKey = "X-Request-ID" RequestIdKey = "request_id" )
Variables ¶
This section is empty.
Functions ¶
func DebugEnable ¶
func DebugEnable() bool
func GetRequestID ¶
func GetZapLogger ¶
func WhitIsCompress ¶
func WhitIsCompress(isCompress bool) optionFun
func WhitIsConsole ¶
func WhitIsConsole(isConsole bool) optionFun
func WhitLoggingDir ¶
func WhitLoggingDir(dir string) optionFun
func WhitMaxAge ¶
func WhitMaxAge(maxAge int) optionFun
func WhitMaxBackup ¶
func WhitMaxBackup(maxBackup int) optionFun
func WhitMaxSize ¶
func WhitMaxSize(maxSize int) optionFun
Types ¶
type LoggerCfg ¶
type LoggerCfg struct { // debug可打印所以sql Level string `yaml:"level"` LoggingDir string `yaml:"dir"` IsCompress bool `yaml:"is_compress"` IsConsole bool `yaml:"is_console"` MaxSize int `yaml:"max_size"` MaxAge int `yaml:"max_age"` MaxBackup int `yaml:"max_backup"` }
func DefaultCfg ¶
func DefaultCfg() *LoggerCfg
Click to show internal directories.
Click to hide internal directories.