Documentation
¶
Index ¶
- func DPanic(args ...interface{})
- func DPanicf(template string, args ...interface{})
- func DPanicw(msg string, keysAndValues ...interface{})
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Flush()
- func GetLevel(level string) zapcore.Level
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func NewSugaredLogger(config zapcore.EncoderConfig, writer zapcore.WriteSyncer, level zapcore.Level, ...) *zap.SugaredLogger
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func SetNodeLogger(node cherryFacade.INode)
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type CherryLogger
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DPanic ¶
func DPanic(args ...interface{})
DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)
func DPanicf ¶
func DPanicf(template string, args ...interface{})
DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)
func DPanicw ¶
func DPanicw(msg string, keysAndValues ...interface{})
DPanicw logs a message with some additional context. In development, the logger then panics. (See DPanicLevel for details.) The variadic key-value pairs are treated as they are in With.
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
When debug-level logging is disabled, this is much faster than
s.With(keysAndValues).Debug(msg)
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Errorw ¶
func Errorw(msg string, keysAndValues ...interface{})
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func Fatalw ¶
func Fatalw(msg string, keysAndValues ...interface{})
Fatalw logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func Infow ¶
func Infow(msg string, keysAndValues ...interface{})
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func NewSugaredLogger ¶ added in v1.1.0
func NewSugaredLogger(config zapcore.EncoderConfig, writer zapcore.WriteSyncer, level zapcore.Level, opts ...zap.Option) *zap.SugaredLogger
func Panic ¶
func Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
func Panicf ¶
func Panicf(template string, args ...interface{})
Panicf uses fmt.Sprintf to log a templated message, then panics.
func Panicw ¶
func Panicw(msg string, keysAndValues ...interface{})
Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.
func SetNodeLogger ¶
func SetNodeLogger(node cherryFacade.INode)
Types ¶
type CherryLogger ¶ added in v1.1.0
type CherryLogger struct { *zap.SugaredLogger *Config }
var (
DefaultLogger *CherryLogger // 默认日志对象(控制台输出)
)
func NewConfigLogger ¶ added in v1.1.0
func NewConfigLogger(config *Config, opts ...zap.Option) *CherryLogger
type Config ¶ added in v1.1.0
type Config struct { Level string // 输出日志等级 StackLevel string // 堆栈输出日志等级 EnableWriteFile bool // 是否输出文件(必需配置FilePath) EnableConsole bool // 是否控制台输出 FilePath string // 日志文件输出路径 MaxSize int // 单个日志文件最大容量(mb) MaxAge int // 最大保留天数 maxAge或MaxBackups任意达到限制,则会被清理 MaxBackups int // 最大备份时间 Compress bool // 是否备份压缩 TimeFormat string // 时间输出格式 PrintCaller bool // 是否打印调用函数 }
func NewConsoleConfig ¶ added in v1.1.0
func NewConsoleConfig() *Config
func (*Config) TimeEncoder ¶ added in v1.1.0
func (c *Config) TimeEncoder() zapcore.TimeEncoder