Documentation ¶
Index ¶
- Variables
- func CustomLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func CustomNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)
- func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func SetLogger(l *Logger)
- func ShortCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)
- type Config
- func (c *Config) DisableConsoleOut()
- func (c *Config) DisableJSONFormat()
- func (c *Config) EnableConsoleOut()
- func (c *Config) EnableJSONFormat()
- func (c *Config) SetCallerSkip(callerSkip int)
- func (c *Config) SetFileOut(path, name string, rotationTime, rotationCount uint)
- func (c *Config) SetLevel(level string)
- func (c *Config) SetProjectName(projectName string)
- func (c *Config) SetStacktraceLevel(level string)
- type Logger
- func (l *Logger) ApplyConfig()
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) Debugw(msg string, keysAndValues ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Errorw(msg string, keysAndValues ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) Infow(msg string, keysAndValues ...interface{})
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Panicw(msg string, keysAndValues ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
- func (l *Logger) Warnw(msg string, keysAndValues ...interface{})
- func (l *Logger) With(args ...interface{}) *zap.SugaredLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var Log = initLogger()
Log is the default logger
Functions ¶
func CustomLevelEncoder ¶
func CustomLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
func CustomNameEncoder ¶
func CustomNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)
func CustomTimeEncoder ¶
func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func ShortCallerEncoder ¶
func ShortCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config log配置文件
func (*Config) DisableConsoleOut ¶
func (c *Config) DisableConsoleOut()
DisableConsoleOut 关闭Console输出
func (*Config) DisableJSONFormat ¶
func (c *Config) DisableJSONFormat()
DisableJSONFormat 关闭JSON格式化输出
func (*Config) SetCallerSkip ¶
SetCallerSkip 设置callerSkip次数
func (*Config) SetFileOut ¶
SetFileOut 设置日志输出文件
func (*Config) SetProjectName ¶
SetProjectName 设置ProjectName
func (*Config) SetStacktraceLevel ¶
SetStacktraceLevel 设置堆栈跟踪的日志级别
type Logger ¶
type Logger struct { Config *Config // contains filtered or unexported fields }
Logger Logger
func (*Logger) With ¶
func (l *Logger) With(args ...interface{}) *zap.SugaredLogger
Click to show internal directories.
Click to hide internal directories.