Documentation ¶
Index ¶
- Constants
- Variables
- func GetFileSuffix(filepath string, suffix string) string
- func SizeToBytes(s string) (int, error)
- type CallerType
- type KeyOptions
- type LevelEncoderType
- type LogEncodeType
- type LogOption
- func CallerKey(key string) LogOption
- func DefaultOptions(logPath string) []LogOption
- func LevelKey(key string) LogOption
- func NameKey(key string) LogOption
- func SetCaller(caller CallerType) LogOption
- func SetCompress(compress bool) LogOption
- func SetHiddenDisplay(hiddenDisplay bool) LogOption
- func SetLevelEncoder(encoder LevelEncoderType) LogOption
- func SetLogEncoder(encoder LogEncodeType) LogOption
- func SetLogLevel(logLevel string) LogOption
- func SetLogPath(path string) LogOption
- func SetMaxAge(maxAge int) LogOption
- func SetMaxBackups(maxBackups int) LogOption
- func SetMaxSize(maxSize int) LogOption
- func SetMessageKey(key string) LogOption
- func SetRotateBy(rotateType RotateType) LogOption
- func SetRotateInterval(rotateInterval RotateInterval) LogOption
- func SetStackTrace(stackTrace bool) LogOption
- func SetTimeEncoderLayout(layout string) LogOption
- func SetWriteBy(writeType WriteType) LogOption
- func StacktraceKey(key string) LogOption
- func TimeKey(key string) LogOption
- type LogOptions
- type Logger
- func (logger *Logger) Debug(msg string, args ...zap.Field)
- func (logger *Logger) Debugf(format string, args ...interface{})
- func (logger *Logger) Error(msg string, args ...zap.Field)
- func (logger *Logger) Errorf(format string, args ...interface{})
- func (logger *Logger) Fatal(msg string, args ...zap.Field)
- func (logger *Logger) Fatalf(format string, args ...interface{})
- func (logger *Logger) Info(msg string, args ...zap.Field)
- func (logger *Logger) Infof(format string, args ...interface{})
- func (logger *Logger) Sync() error
- func (logger *Logger) Warn(msg string, args ...zap.Field)
- func (logger *Logger) Warnf(format string, args ...interface{})
- func (logger *Logger) With(k string, v interface{}) zap.Field
- func (logger *Logger) WithError(err error) zap.Field
- type RotateInterval
- type RotateType
- type WriteType
Constants ¶
View Source
const ( RotateByDate RotateType = 1 RotateBySize RotateType = 2 WriteLevel WriteType = 1 WriteSingle WriteType = 2 EncodeJson LogEncodeType = "json" EncodeConsole LogEncodeType = "console" LevelCapital LevelEncoderType = 1 LevelLower LevelEncoderType = 2 NoCaller = 1 ShortCaller = 2 FullCaller = 3 )
View Source
const ( RotateIntervalMinute = "minute" RotateIntervalHour = "hour" RotateIntervalDay = "day" RotateIntervalMonth = "month" RotateIntervalYear = "year" )
View Source
const ( BYTE = 1 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE TERABYTE )
Variables ¶
Functions ¶
Types ¶
type KeyOptions ¶
type KeyOptions struct { MessageKey string `json:"message_key" yaml:"message_key" toml:"message_key"` LevelKey string `json:"level_key" yaml:"level_key" toml:"level_key"` TimeKey string `json:"time_key" yaml:"time_key" toml:"time_key"` NameKey string `json:"name_key" yaml:"name_key" toml:"name_key"` CallerKey string `json:"caller_key" yaml:"caller_key" toml:"caller_key"` StacktraceKey string `json:"stack_trace_key" yaml:"stack_trace_key" toml:"stack_trace_key"` }
type LogOption ¶
type LogOption func(*LogOptions)
func SetCaller ¶
func SetCaller(caller CallerType) LogOption
func SetLevelEncoder ¶
func SetLevelEncoder(encoder LevelEncoderType) LogOption
func SetLogEncoder ¶
func SetLogEncoder(encoder LogEncodeType) LogOption
func SetRotateBy ¶
func SetRotateBy(rotateType RotateType) LogOption
func SetRotateInterval ¶
func SetRotateInterval(rotateInterval RotateInterval) LogOption
type LogOptions ¶
type LogOptions struct { LogPath string `json:"log_path" yaml:"log_path" toml:"log_path"` LogLevel zapcore.Level `json:"log_level" yaml:"log_level" toml:"log_level"` WriteBy WriteType `json:"write_by" yaml:"write_by" toml:"write_by"` MaxAge int `json:"max_age" yaml:"max_age" toml:"max_age"` HiddenDisplay bool `json:"in_console" yaml:"in_console" toml:"in_console"` RotateBy RotateType `json:"rotate_by" yaml:"rotate_by" toml:"rotate_by"` MaxSize int `json:"max_size" yaml:"max_size" toml:"max_size"` MaxBackups int `json:"max_backups" yaml:"max_backups" toml:"max_backups"` Compress bool `json:"compress" yaml:"compress" toml:"compress"` RotateInterval RotateInterval `json:"rotate_interval" yaml:"rotate_interval" toml:"rotate_interval"` Caller CallerType `json:"caller_type" yaml:"caller_type" toml:"caller_type"` StackTrace bool `json:"stack_trace" yaml:"stack_trace" toml:"stack_trace"` LogEncoder LogEncodeType `json:"log_encoder" yaml:"log_encoder" toml:"log_encoder"` LevelEncoder LevelEncoderType `json:"level_encoder" yaml:"level_encoder" toml:"level_encoder"` TimeEncoderLayout string `json:"time_encoder_layout" yaml:"time_encoder_layout" toml:"time_encoder_layout"` Keys KeyOptions `json:"keys" yaml:"keys" toml:"keys"` }
type Logger ¶ added in v0.1.3
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) Debugf ¶ added in v0.1.3
func (*Logger) Errorf ¶ added in v0.1.3
func (*Logger) Fatalf ¶ added in v0.1.3
func (*Logger) Infof ¶ added in v0.1.3
func (*Logger) Warnf ¶ added in v0.1.3
type RotateInterval ¶
type RotateInterval string
func (RotateInterval) Format ¶
func (t RotateInterval) Format() string
func (RotateInterval) RotationGap ¶
func (t RotateInterval) RotationGap() time.Duration
Click to show internal directories.
Click to hide internal directories.