Documentation ¶
Index ¶
- Constants
- func AddContext(ctx context.Context, fields ...zap.Field) context.Context
- func Debug(msg string, args ...zap.Field)
- func Debugf(format string, args ...interface{})
- func Error(msg string, args ...zap.Field)
- func Errorf(format string, args ...interface{})
- func Fatal(msg string, args ...zap.Field)
- func Fatalf(format string, args ...interface{})
- func GAddContext(ctx *gin.Context, fields ...zap.Field)
- func Info(msg string, args ...zap.Field)
- func Infof(format string, args ...interface{})
- func Warn(msg string, args ...zap.Field)
- func Warnf(format string, args ...interface{})
- func With(k string, v interface{}) zap.Field
- func WithError(err error) zap.Field
- type Log
- func (l *Log) Debug(msg string, args ...zap.Field)
- func (l *Log) Debugf(format string, args ...interface{})
- func (l *Log) Error(msg string, args ...zap.Field)
- func (l *Log) Errorf(format string, args ...interface{})
- func (l *Log) Fatal(msg string, args ...zap.Field)
- func (l *Log) Fatalf(format string, args ...interface{})
- func (l *Log) Info(msg string, args ...zap.Field)
- func (l *Log) Infof(format string, args ...interface{})
- func (l *Log) Warn(msg string, args ...zap.Field)
- func (l *Log) Warnf(format string, args ...interface{})
- type LogOptions
- func (c *LogOptions) CloseConsoleDisplay()
- func (c *LogOptions) InitLogger() *Log
- func (c *LogOptions) SetCaller(b bool)
- func (c *LogOptions) SetDivision(division string)
- func (c *LogOptions) SetEncodeTime(format string)
- func (c *LogOptions) SetEncoding(encoding string)
- func (c *LogOptions) SetErrorFile(path string)
- func (c *LogOptions) SetInfoFile(path string)
- func (c *LogOptions) SetTimeUnit(t TimeUnit)
- type TimeUnit
Constants ¶
View Source
const ( TimeDivision = "time" SizeDivision = "size" )
View Source
const ( Minute = "minute" Hour = "hour" Day = "day" Month = "month" Year = "year" RFC3339 = "2006-01-02T15:04:05Z07:00" )
Variables ¶
This section is empty.
Functions ¶
func AddContext ¶ added in v0.3.1
Types ¶
type LogOptions ¶
type LogOptions struct { // Encoding sets the logger's encoding. Valid values are "json" and // "console", as well as any third-party encodings registered via // RegisterEncoder. Encoding string `json:"encoding" yaml:"encoding" toml:"encoding"` InfoFilename string `json:"info_filename" yaml:"info_filename" toml:"info_filename"` ErrorFilename string `json:"error_filename" yaml:"error_filename" toml:"error_filename"` MaxSize int `json:"max_size" yaml:"max_size" toml:"max_size"` MaxBackups int `json:"max_backups" yaml:"max_backups" toml:"max_backups"` MaxAge int `json:"max_age" yaml:"max_age" toml:"max_age"` Compress bool `json:"compress" yaml:"compress" toml:"compress"` Division string `json:"division" yaml:"division" toml:"division"` LevelSeparate bool `json:"level_separate" yaml:"level_separate" toml:"level_separate"` TimeUnit TimeUnit `json:"time_unit" yaml:"time_unit" toml:"time_unit"` Stacktrace bool `json:"stacktrace" yaml:"stacktrace" toml:"stacktrace"` EncodeTime string `json:"encode_time" yaml:"encode_time" toml:"encode_time"` // contains filtered or unexported fields }
func New ¶
func New() *LogOptions
func NewFromJson ¶
func NewFromJson(confPath string) *LogOptions
func NewFromToml ¶
func NewFromToml(confPath string) *LogOptions
func NewFromYaml ¶
func NewFromYaml(confPath string) *LogOptions
func (*LogOptions) CloseConsoleDisplay ¶
func (c *LogOptions) CloseConsoleDisplay()
func (*LogOptions) InitLogger ¶
func (c *LogOptions) InitLogger() *Log
func (*LogOptions) SetCaller ¶
func (c *LogOptions) SetCaller(b bool)
func (*LogOptions) SetDivision ¶
func (c *LogOptions) SetDivision(division string)
func (*LogOptions) SetEncodeTime ¶ added in v0.3.2
func (c *LogOptions) SetEncodeTime(format string)
func (*LogOptions) SetEncoding ¶
func (c *LogOptions) SetEncoding(encoding string)
func (*LogOptions) SetErrorFile ¶
func (c *LogOptions) SetErrorFile(path string)
func (*LogOptions) SetInfoFile ¶
func (c *LogOptions) SetInfoFile(path string)
func (*LogOptions) SetTimeUnit ¶
func (c *LogOptions) SetTimeUnit(t TimeUnit)
Click to show internal directories.
Click to hide internal directories.