Documentation
¶
Index ¶
- Constants
- Variables
- func Caller(skip int, fast bool) (file string, line int, loaded bool)
- func NewFlatEncoder(buf *bytes.Buffer, separator string) *flatEncoder
- func NewJSONEncoder(buf *bytes.Buffer) *jsonEncoder
- func Refresh(fileName string) error
- func RefreshBuffer(buffer string, ext string) error
- func RefreshReader(input io.Reader, ext string) error
- func RegisterConverter(fn util.Converter)
- func RegisterPlugin(name string, typ string, i interface{})
- func RegisterReader(r Reader, ext ...string)
- type Appender
- type AppenderRef
- type ArrayValue
- type BaseAppender
- type BaseFilter
- type BoolValue
- type BoolsValue
- type ColorStyle
- type CompositeFilter
- type ConsoleAppender
- type ContextEntry
- func (e *ContextEntry) Context() context.Context
- func (e ContextEntry) Debug(args ...interface{}) *Event
- func (e ContextEntry) Debugf(format string, args ...interface{}) *Event
- func (e ContextEntry) Debugw(fields ...Field) *Event
- func (e *ContextEntry) Errno() Errno
- func (e ContextEntry) Error(errno Errno, args ...interface{}) *Event
- func (e ContextEntry) Errorf(errno Errno, format string, args ...interface{}) *Event
- func (e ContextEntry) Errorw(errno Errno, fields ...Field) *Event
- func (e ContextEntry) Fatal(args ...interface{}) *Event
- func (e ContextEntry) Fatalf(format string, args ...interface{}) *Event
- func (e ContextEntry) Fatalw(fields ...Field) *Event
- func (e ContextEntry) Info(args ...interface{}) *Event
- func (e ContextEntry) Infof(format string, args ...interface{}) *Event
- func (e ContextEntry) Infow(fields ...Field) *Event
- func (e ContextEntry) Panic(args ...interface{}) *Event
- func (e ContextEntry) Panicf(format string, args ...interface{}) *Event
- func (e ContextEntry) Panicw(fields ...Field) *Event
- func (e *ContextEntry) Tag() string
- func (e ContextEntry) Trace(args ...interface{}) *Event
- func (e ContextEntry) Tracef(format string, args ...interface{}) *Event
- func (e ContextEntry) Tracew(fields ...Field) *Event
- func (e ContextEntry) Warn(args ...interface{}) *Event
- func (e ContextEntry) Warnf(format string, args ...interface{}) *Event
- func (e ContextEntry) Warnw(fields ...Field) *Event
- func (e ContextEntry) WithSkip(n int) ContextEntry
- func (e ContextEntry) WithTag(tag string) ContextEntry
- type DefaultLayout
- type DenyAllFilter
- type Encoder
- type Entry
- type Errno
- type Event
- type Field
- func Any(key string, value interface{}) Field
- func Array(key string, val ...Value) Field
- func Bool(key string, val bool) Field
- func Boolp(key string, val *bool) Field
- func Bools(key string, val []bool) Field
- func Float32(key string, val float32) Field
- func Float32p(key string, val *float32) Field
- func Float32s(key string, val []float32) Field
- func Float64(key string, val float64) Field
- func Float64p(key string, val *float64) Field
- func Float64s(key string, val []float64) Field
- func Int(key string, val int) Field
- func Int16(key string, val int16) Field
- func Int16p(key string, val *int16) Field
- func Int16s(key string, val []int16) Field
- func Int32(key string, val int32) Field
- func Int32p(key string, val *int32) Field
- func Int32s(key string, val []int32) Field
- func Int64(key string, val int64) Field
- func Int64p(key string, val *int64) Field
- func Int64s(key string, val []int64) Field
- func Int8(key string, val int8) Field
- func Int8p(key string, val *int8) Field
- func Int8s(key string, val []int8) Field
- func Intp(key string, val *int) Field
- func Ints(key string, val []int) Field
- func Message(format string, args ...interface{}) Field
- func Object(key string, fields ...Field) Field
- func Reflect(key string, val interface{}) Field
- func String(key string, val string) Field
- func Stringp(key string, val *string) Field
- func Strings(key string, val []string) Field
- func Uint(key string, val uint) Field
- func Uint16(key string, val uint16) Field
- func Uint16p(key string, val *uint16) Field
- func Uint16s(key string, val []uint16) Field
- func Uint32(key string, val uint32) Field
- func Uint32p(key string, val *uint32) Field
- func Uint32s(key string, val []uint32) Field
- func Uint64(key string, val uint64) Field
- func Uint64p(key string, val *uint64) Field
- func Uint64s(key string, val []uint64) Field
- func Uint8(key string, val uint8) Field
- func Uint8p(key string, val *uint8) Field
- func Uint8s(key string, val []uint8) Field
- func Uintp(key string, val *uint) Field
- func Uints(key string, val []uint) Field
- type FileAppender
- type FileWriter
- type Filter
- type Float32sValue
- type Float64Value
- type Float64sValue
- type FormatFunc
- type Initializer
- type Int16sValue
- type Int32sValue
- type Int64Value
- type Int64sValue
- type Int8sValue
- type IntsValue
- type JSONLayout
- type Layout
- type Level
- type LevelFilter
- type LevelMatchFilter
- type LevelRangeFilter
- type LifeCycle
- type Logger
- func (l *Logger) Appenders() []Appender
- func (l *Logger) Debug(args ...interface{}) *Event
- func (l *Logger) Debugf(format string, args ...interface{}) *Event
- func (l *Logger) Debugw(fields ...Field) *Event
- func (l *Logger) Error(args ...interface{}) *Event
- func (l *Logger) Errorf(format string, args ...interface{}) *Event
- func (l *Logger) Errorw(fields ...Field) *Event
- func (l *Logger) Fatal(args ...interface{}) *Event
- func (l *Logger) Fatalf(format string, args ...interface{}) *Event
- func (l *Logger) Fatalw(fields ...Field) *Event
- func (l *Logger) Filter() Filter
- func (l *Logger) Info(args ...interface{}) *Event
- func (l *Logger) Infof(format string, args ...interface{}) *Event
- func (l *Logger) Infow(fields ...Field) *Event
- func (l *Logger) Level() Level
- func (l *Logger) Name() string
- func (l *Logger) Panic(args ...interface{}) *Event
- func (l *Logger) Panicf(format string, args ...interface{}) *Event
- func (l *Logger) Panicw(fields ...Field) *Event
- func (l *Logger) Trace(args ...interface{}) *Event
- func (l *Logger) Tracef(format string, args ...interface{}) *Event
- func (l *Logger) Tracew(fields ...Field) *Event
- func (l *Logger) Warn(args ...interface{}) *Event
- func (l *Logger) Warnf(format string, args ...interface{}) *Event
- func (l *Logger) Warnw(fields ...Field) *Event
- func (l *Logger) WithContext(ctx context.Context) ContextEntry
- func (l *Logger) WithSkip(n int) SimpleEntry
- func (l *Logger) WithTag(tag string) SimpleEntry
- type MessageValue
- type Node
- type NullAppender
- type ObjectValue
- type Plugin
- type PluginTag
- type Reader
- type ReflectValue
- type Result
- type RollingFileAppender
- type SimpleEntry
- func (e *SimpleEntry) Context() context.Context
- func (e SimpleEntry) Debug(args ...interface{}) *Event
- func (e SimpleEntry) Debugf(format string, args ...interface{}) *Event
- func (e SimpleEntry) Debugw(fields ...Field) *Event
- func (e *SimpleEntry) Errno() Errno
- func (e SimpleEntry) Error(args ...interface{}) *Event
- func (e SimpleEntry) Errorf(format string, args ...interface{}) *Event
- func (e SimpleEntry) Errorw(fields ...Field) *Event
- func (e SimpleEntry) Fatal(args ...interface{}) *Event
- func (e SimpleEntry) Fatalf(format string, args ...interface{}) *Event
- func (e SimpleEntry) Fatalw(fields ...Field) *Event
- func (e SimpleEntry) Info(args ...interface{}) *Event
- func (e SimpleEntry) Infof(format string, args ...interface{}) *Event
- func (e SimpleEntry) Infow(fields ...Field) *Event
- func (e SimpleEntry) Panic(args ...interface{}) *Event
- func (e SimpleEntry) Panicf(format string, args ...interface{}) *Event
- func (e SimpleEntry) Panicw(fields ...Field) *Event
- func (e *SimpleEntry) Tag() string
- func (e SimpleEntry) Trace(args ...interface{}) *Event
- func (e SimpleEntry) Tracef(format string, args ...interface{}) *Event
- func (e SimpleEntry) Tracew(fields ...Field) *Event
- func (e SimpleEntry) Warn(args ...interface{}) *Event
- func (e SimpleEntry) Warnf(format string, args ...interface{}) *Event
- func (e SimpleEntry) Warnw(fields ...Field) *Event
- func (e SimpleEntry) WithContext(ctx context.Context) ContextEntry
- func (e SimpleEntry) WithSkip(n int) SimpleEntry
- func (e SimpleEntry) WithTag(tag string) SimpleEntry
- type StringValue
- type StringsValue
- type TagFilter
- type TimeFilter
- type Uint16sValue
- type Uint32sValue
- type Uint64Value
- type Uint64sValue
- type Uint8sValue
- type UintsValue
- type Value
- type Writer
- type XMLReader
Constants ¶
const ( ResultAccept = Result(iota) ResultDeny )
const ( ColorStyleNone = ColorStyle(iota) ColorStyleNormal ColorStyleBright )
const ( NoneLevel = Level(iota) TraceLevel DebugLevel InfoLevel WarnLevel ErrorLevel PanicLevel FatalLevel OffLevel )
const ( PluginTypeAppender = "Appender" PluginTypeFilter = "Filter" PluginTypeLayout = "Layout" )
Variables ¶
var ( // Status records events that occur in the logging system. Status = newLogger("", ErrorLevel) )
var Writers = &writers{ writers: make(map[string]*sharedWriter), }
Writers manages the Get and Release of Writer(s).
Functions ¶
func NewFlatEncoder ¶ added in v1.1.1
func NewJSONEncoder ¶ added in v1.1.1
func RefreshBuffer ¶ added in v1.1.1
RefreshBuffer 加载日志配置文件。
func RefreshReader ¶ added in v1.1.1
RefreshReader 加载日志配置文件。
func RegisterConverter ¶
RegisterConverter registers Converter for non-primitive type such as time.Time, time.Duration, or other user-defined value type.
func RegisterPlugin ¶
RegisterPlugin registers a Plugin, `i` is used to obtain the type of Plugin.
Types ¶
type Appender ¶
Appender represents an output destination. Do not provide an asynchronous appender, because we have asynchronous logger.
type AppenderRef ¶
type AppenderRef struct {
Ref string `PluginAttribute:"ref"`
Filter Filter `PluginElement:"Filter"`
Level Level `PluginAttribute:"level,default=none"`
// contains filtered or unexported fields
}
AppenderRef is a reference to an Appender.
func (*AppenderRef) Append ¶
func (r *AppenderRef) Append(e *Event)
type ArrayValue ¶ added in v1.1.1
type ArrayValue []Value
func (ArrayValue) Encode ¶ added in v1.1.1
func (v ArrayValue) Encode(enc Encoder) error
type BaseAppender ¶
type BaseAppender struct {
Name string `PluginAttribute:"name"`
Layout Layout `PluginElement:"Layout,default=DefaultLayout"`
}
func (*BaseAppender) GetLayout ¶
func (c *BaseAppender) GetLayout() Layout
func (*BaseAppender) GetName ¶
func (c *BaseAppender) GetName() string
func (*BaseAppender) Start ¶
func (c *BaseAppender) Start() error
func (*BaseAppender) Stop ¶
func (c *BaseAppender) Stop(ctx context.Context)
type BaseFilter ¶
type BaseFilter struct {
OnMatch Result `PluginAttribute:"onMatch,default=accept"`
OnMismatch Result `PluginAttribute:"onMismatch,default=deny"`
}
func (*BaseFilter) Start ¶
func (c *BaseFilter) Start() error
func (*BaseFilter) Stop ¶
func (c *BaseFilter) Stop(ctx context.Context)
type BoolsValue ¶ added in v1.1.1
type BoolsValue []bool
func (BoolsValue) Encode ¶ added in v1.1.1
func (v BoolsValue) Encode(enc Encoder) error
type ColorStyle ¶
type ColorStyle int
func ParseColorStyle ¶
func ParseColorStyle(s string) (ColorStyle, error)
type CompositeFilter ¶
type CompositeFilter struct {
Filters []Filter `PluginElement:"Filter"`
}
CompositeFilter composes and invokes one or more filters.
func (*CompositeFilter) Filter ¶
func (f *CompositeFilter) Filter(level Level, e Entry, fields []Field) Result
func (*CompositeFilter) Start ¶
func (f *CompositeFilter) Start() error
func (*CompositeFilter) Stop ¶
func (f *CompositeFilter) Stop(ctx context.Context)
type ConsoleAppender ¶
type ConsoleAppender struct {
BaseAppender
}
ConsoleAppender is an Appender that writing messages to os.Stdout.
func (*ConsoleAppender) Append ¶
func (c *ConsoleAppender) Append(e *Event)
type ContextEntry ¶
type ContextEntry struct {
// contains filtered or unexported fields
}
ContextEntry is an Entry implementation that has context and errno.
func (*ContextEntry) Context ¶
func (e *ContextEntry) Context() context.Context
func (ContextEntry) Debug ¶
func (e ContextEntry) Debug(args ...interface{}) *Event
Debug outputs log with level DebugLevel.
func (ContextEntry) Debugf ¶
func (e ContextEntry) Debugf(format string, args ...interface{}) *Event
Debugf outputs log with level DebugLevel.
func (ContextEntry) Debugw ¶ added in v1.1.1
func (e ContextEntry) Debugw(fields ...Field) *Event
Debugw outputs log with level DebugLevel.
func (*ContextEntry) Errno ¶
func (e *ContextEntry) Errno() Errno
func (ContextEntry) Error ¶
func (e ContextEntry) Error(errno Errno, args ...interface{}) *Event
Error outputs log with level ErrorLevel.
func (ContextEntry) Errorf ¶
func (e ContextEntry) Errorf(errno Errno, format string, args ...interface{}) *Event
Errorf outputs log with level ErrorLevel.
func (ContextEntry) Errorw ¶ added in v1.1.1
func (e ContextEntry) Errorw(errno Errno, fields ...Field) *Event
Errorw outputs log with level ErrorLevel.
func (ContextEntry) Fatal ¶
func (e ContextEntry) Fatal(args ...interface{}) *Event
Fatal outputs log with level FatalLevel.
func (ContextEntry) Fatalf ¶
func (e ContextEntry) Fatalf(format string, args ...interface{}) *Event
Fatalf outputs log with level FatalLevel.
func (ContextEntry) Fatalw ¶ added in v1.1.1
func (e ContextEntry) Fatalw(fields ...Field) *Event
Fatalw outputs log with level FatalLevel.
func (ContextEntry) Info ¶
func (e ContextEntry) Info(args ...interface{}) *Event
Info outputs log with level InfoLevel.
func (ContextEntry) Infof ¶
func (e ContextEntry) Infof(format string, args ...interface{}) *Event
Infof outputs log with level InfoLevel.
func (ContextEntry) Infow ¶ added in v1.1.1
func (e ContextEntry) Infow(fields ...Field) *Event
Infow outputs log with level InfoLevel.
func (ContextEntry) Panic ¶
func (e ContextEntry) Panic(args ...interface{}) *Event
Panic outputs log with level PanicLevel.
func (ContextEntry) Panicf ¶
func (e ContextEntry) Panicf(format string, args ...interface{}) *Event
Panicf outputs log with level PanicLevel.
func (ContextEntry) Panicw ¶ added in v1.1.1
func (e ContextEntry) Panicw(fields ...Field) *Event
Panicw outputs log with level PanicLevel.
func (*ContextEntry) Tag ¶
func (e *ContextEntry) Tag() string
func (ContextEntry) Trace ¶
func (e ContextEntry) Trace(args ...interface{}) *Event
Trace outputs log with level TraceLevel.
func (ContextEntry) Tracef ¶
func (e ContextEntry) Tracef(format string, args ...interface{}) *Event
Tracef outputs log with level TraceLevel.
func (ContextEntry) Tracew ¶ added in v1.1.1
func (e ContextEntry) Tracew(fields ...Field) *Event
Tracew outputs log with level TraceLevel.
func (ContextEntry) Warn ¶
func (e ContextEntry) Warn(args ...interface{}) *Event
Warn outputs log with level WarnLevel.
func (ContextEntry) Warnf ¶
func (e ContextEntry) Warnf(format string, args ...interface{}) *Event
Warnf outputs log with level WarnLevel.
func (ContextEntry) Warnw ¶ added in v1.1.1
func (e ContextEntry) Warnw(fields ...Field) *Event
Warnw outputs log with level WarnLevel.
func (ContextEntry) WithSkip ¶
func (e ContextEntry) WithSkip(n int) ContextEntry
func (ContextEntry) WithTag ¶
func (e ContextEntry) WithTag(tag string) ContextEntry
type DefaultLayout ¶
type DefaultLayout struct {
LineBreak bool `PluginAttribute:"lineBreak,default=true"`
ColorStyle ColorStyle `PluginAttribute:"colorStyle,default=none"`
Formatter string `PluginAttribute:"formatter,default="`
// contains filtered or unexported fields
}
func (*DefaultLayout) Init ¶ added in v1.1.1
func (c *DefaultLayout) Init() error
type DenyAllFilter ¶
type DenyAllFilter struct{}
DenyAllFilter causes all logging events to be dropped.
func (*DenyAllFilter) Start ¶
func (f *DenyAllFilter) Start() error
func (*DenyAllFilter) Stop ¶
func (f *DenyAllFilter) Stop(ctx context.Context)
type Encoder ¶ added in v1.1.1
type Encoder interface {
AppendEncoderBegin() error
AppendEncoderEnd() error
AppendObjectBegin() error
AppendObjectEnd() error
AppendArrayBegin() error
AppendArrayEnd() error
AppendKey(key string) error
AppendBool(bool) error
AppendInt64(int64) error
AppendUint64(uint64) error
AppendFloat64(float64) error
AppendString(string) error
AppendReflect(v interface{}) error
AppendBuffer([]byte) error
}
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event provides contextual information about a log message.
type Field ¶ added in v1.1.1
func Boolp ¶ added in v1.1.1
Boolp constructs a field that carries a *bool. The returned Field will safely and explicitly represent `nil` when appropriate.
func Float32 ¶ added in v1.1.1
Float32 constructs a field that carries a float32. The way the floating-point value is represented is encoder-dependent, so marshaling is necessarily lazy.
func Float32p ¶ added in v1.1.1
Float32p constructs a field that carries a *float32. The returned Field will safely and explicitly represent `nil` when appropriate.
func Float64 ¶ added in v1.1.1
Float64 constructs a field that carries a float64. The way the floating-point value is represented is encoder-dependent, so marshaling is necessarily lazy.
func Float64p ¶ added in v1.1.1
Float64p constructs a field that carries a *float64. The returned Field will safely and explicitly represent `nil` when appropriate.
func Int16p ¶ added in v1.1.1
Int16p constructs a field that carries a *int16. The returned Field will safely and explicitly represent `nil` when appropriate.
func Int32p ¶ added in v1.1.1
Int32p constructs a field that carries a *int32. The returned Field will safely and explicitly represent `nil` when appropriate.
func Int64p ¶ added in v1.1.1
Int64p constructs a field that carries a *int64. The returned Field will safely and explicitly represent `nil` when appropriate.
func Int8p ¶ added in v1.1.1
Int8p constructs a field that carries a *int8. The returned Field will safely and explicitly represent `nil` when appropriate.
func Intp ¶ added in v1.1.1
Intp constructs a field that carries a *int. The returned Field will safely and explicitly represent `nil` when appropriate.
func Reflect ¶ added in v1.1.1
Reflect constructs a field with the given key and an arbitrary object.
func Stringp ¶ added in v1.1.1
Stringp constructs a field that carries a *string. The returned Field will safely and explicitly represent `nil` when appropriate.
func Uint16p ¶ added in v1.1.1
Uint16p constructs a field that carries a *uint16. The returned Field will safely and explicitly represent `nil` when appropriate.
func Uint32p ¶ added in v1.1.1
Uint32p constructs a field that carries a *uint32. The returned Field will safely and explicitly represent `nil` when appropriate.
func Uint64p ¶ added in v1.1.1
Uint64p constructs a field that carries a *uint64. The returned Field will safely and explicitly represent `nil` when appropriate.
func Uint8p ¶ added in v1.1.1
Uint8p constructs a field that carries a *uint8. The returned Field will safely and explicitly represent `nil` when appropriate.
type FileAppender ¶
type FileAppender struct {
BaseAppender
FileName string `PluginAttribute:"fileName"`
// contains filtered or unexported fields
}
FileAppender is an Appender writing messages to *os.File.
func (*FileAppender) Append ¶
func (c *FileAppender) Append(e *Event)
func (*FileAppender) Start ¶
func (c *FileAppender) Start() error
func (*FileAppender) Stop ¶
func (c *FileAppender) Stop(ctx context.Context)
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter is a Writer implementation by *os.File.
func (*FileWriter) Name ¶
func (c *FileWriter) Name() string
func (*FileWriter) Stop ¶
func (c *FileWriter) Stop(ctx context.Context)
type Filter ¶
Filter is an interface that tells the logger a log message should be dropped when the Filter method returns ResultDeny. Filter 只应该出现在两个地方,一个是 Logger 上,用于控制消息是否打印,另一个是 AppenderRef,用于控制消息是否输出到 Appender 上,即控制消息路由。
type Float32sValue ¶ added in v1.1.1
type Float32sValue []float32
func (Float32sValue) Encode ¶ added in v1.1.1
func (v Float32sValue) Encode(enc Encoder) error
type Float64Value ¶ added in v1.1.1
type Float64Value float64
func (Float64Value) Encode ¶ added in v1.1.1
func (v Float64Value) Encode(enc Encoder) error
type Float64sValue ¶ added in v1.1.1
type Float64sValue []float64
func (Float64sValue) Encode ¶ added in v1.1.1
func (v Float64sValue) Encode(enc Encoder) error
type FormatFunc ¶ added in v1.1.1
type Initializer ¶
type Initializer interface {
Init() error
}
type Int16sValue ¶ added in v1.1.1
type Int16sValue []int16
func (Int16sValue) Encode ¶ added in v1.1.1
func (v Int16sValue) Encode(enc Encoder) error
type Int32sValue ¶ added in v1.1.1
type Int32sValue []int32
func (Int32sValue) Encode ¶ added in v1.1.1
func (v Int32sValue) Encode(enc Encoder) error
type Int64Value ¶ added in v1.1.1
type Int64Value int64
func (Int64Value) Encode ¶ added in v1.1.1
func (v Int64Value) Encode(enc Encoder) error
type Int64sValue ¶ added in v1.1.1
type Int64sValue []int64
func (Int64sValue) Encode ¶ added in v1.1.1
func (v Int64sValue) Encode(enc Encoder) error
type Int8sValue ¶ added in v1.1.1
type Int8sValue []int8
func (Int8sValue) Encode ¶ added in v1.1.1
func (v Int8sValue) Encode(enc Encoder) error
type JSONLayout ¶ added in v1.1.1
type JSONLayout struct {
LineBreak bool `PluginAttribute:"lineBreak,default=true"`
}
type Level ¶
type Level int32
Level used for identifying the severity of an event.
func ParseLevel ¶
ParseLevel parses string to a level, and returns error if the conversion fails.
type LevelFilter ¶
type LevelFilter struct {
BaseFilter
Level Level `PluginAttribute:"level"`
}
LevelFilter logs events if the level in the Event is same or more specific than the configured level.
type LevelMatchFilter ¶
type LevelMatchFilter struct {
BaseFilter
Level Level `PluginAttribute:"level"`
}
LevelMatchFilter logs events if the level in the Event matches the specified logging level exactly.
type LevelRangeFilter ¶
type LevelRangeFilter struct {
BaseFilter
MinLevel Level `PluginAttribute:"minLevel"`
MaxLevel Level `PluginAttribute:"maxLevel"`
}
LevelRangeFilter logs events if the level in the Event is in the range of the configured min and max levels.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) WithContext ¶
func (l *Logger) WithContext(ctx context.Context) ContextEntry
WithContext 创建包含 context.Context 对象的 Entry 。
func (*Logger) WithSkip ¶
func (l *Logger) WithSkip(n int) SimpleEntry
WithSkip 创建包含 skip 信息的 Entry 。
func (*Logger) WithTag ¶
func (l *Logger) WithTag(tag string) SimpleEntry
WithTag 创建包含 tag 信息的 Entry 。
type MessageValue ¶ added in v1.1.1
type MessageValue struct {
// contains filtered or unexported fields
}
func (MessageValue) Encode ¶ added in v1.1.1
func (v MessageValue) Encode(enc Encoder) error
type NullAppender ¶
type NullAppender struct{}
NullAppender is an Appender that ignores log events.
func (*NullAppender) Append ¶
func (c *NullAppender) Append(e *Event)
func (*NullAppender) GetLayout ¶ added in v1.1.1
func (c *NullAppender) GetLayout() Layout
func (*NullAppender) GetName ¶ added in v1.1.1
func (c *NullAppender) GetName() string
func (*NullAppender) Start ¶
func (c *NullAppender) Start() error
func (*NullAppender) Stop ¶
func (c *NullAppender) Stop(ctx context.Context)
type ObjectValue ¶ added in v1.1.1
type ObjectValue []Field
func (ObjectValue) Encode ¶ added in v1.1.1
func (v ObjectValue) Encode(enc Encoder) error
type ReflectValue ¶ added in v1.1.1
type ReflectValue struct {
Val interface{}
}
func (ReflectValue) Encode ¶ added in v1.1.1
func (v ReflectValue) Encode(enc Encoder) error
type RollingFileAppender ¶
type RollingFileAppender struct {
BaseAppender
}
func (*RollingFileAppender) Append ¶
func (c *RollingFileAppender) Append(e *Event)
type SimpleEntry ¶
type SimpleEntry struct {
// contains filtered or unexported fields
}
SimpleEntry is an Entry implementation that has no context.
func (*SimpleEntry) Context ¶
func (e *SimpleEntry) Context() context.Context
func (SimpleEntry) Debug ¶
func (e SimpleEntry) Debug(args ...interface{}) *Event
Debug outputs log with level DebugLevel.
func (SimpleEntry) Debugf ¶
func (e SimpleEntry) Debugf(format string, args ...interface{}) *Event
Debugf outputs log with level DebugLevel.
func (SimpleEntry) Debugw ¶ added in v1.1.1
func (e SimpleEntry) Debugw(fields ...Field) *Event
Debugw outputs log with level DebugLevel.
func (*SimpleEntry) Errno ¶
func (e *SimpleEntry) Errno() Errno
func (SimpleEntry) Error ¶
func (e SimpleEntry) Error(args ...interface{}) *Event
Error outputs log with level ErrorLevel.
func (SimpleEntry) Errorf ¶
func (e SimpleEntry) Errorf(format string, args ...interface{}) *Event
Errorf outputs log with level ErrorLevel.
func (SimpleEntry) Errorw ¶ added in v1.1.1
func (e SimpleEntry) Errorw(fields ...Field) *Event
Errorw outputs log with level ErrorLevel.
func (SimpleEntry) Fatal ¶
func (e SimpleEntry) Fatal(args ...interface{}) *Event
Fatal outputs log with level FatalLevel.
func (SimpleEntry) Fatalf ¶
func (e SimpleEntry) Fatalf(format string, args ...interface{}) *Event
Fatalf outputs log with level FatalLevel.
func (SimpleEntry) Fatalw ¶ added in v1.1.1
func (e SimpleEntry) Fatalw(fields ...Field) *Event
Fatalw outputs log with level FatalLevel.
func (SimpleEntry) Info ¶
func (e SimpleEntry) Info(args ...interface{}) *Event
Info outputs log with level InfoLevel.
func (SimpleEntry) Infof ¶
func (e SimpleEntry) Infof(format string, args ...interface{}) *Event
Infof outputs log with level InfoLevel.
func (SimpleEntry) Infow ¶ added in v1.1.1
func (e SimpleEntry) Infow(fields ...Field) *Event
Infow outputs log with level InfoLevel.
func (SimpleEntry) Panic ¶
func (e SimpleEntry) Panic(args ...interface{}) *Event
Panic outputs log with level PanicLevel.
func (SimpleEntry) Panicf ¶
func (e SimpleEntry) Panicf(format string, args ...interface{}) *Event
Panicf outputs log with level PanicLevel.
func (SimpleEntry) Panicw ¶ added in v1.1.1
func (e SimpleEntry) Panicw(fields ...Field) *Event
Panicw outputs log with level PanicLevel.
func (*SimpleEntry) Tag ¶
func (e *SimpleEntry) Tag() string
func (SimpleEntry) Trace ¶
func (e SimpleEntry) Trace(args ...interface{}) *Event
Trace outputs log with level TraceLevel.
func (SimpleEntry) Tracef ¶
func (e SimpleEntry) Tracef(format string, args ...interface{}) *Event
Tracef outputs log with level TraceLevel.
func (SimpleEntry) Tracew ¶ added in v1.1.1
func (e SimpleEntry) Tracew(fields ...Field) *Event
Tracew outputs log with level TraceLevel.
func (SimpleEntry) Warn ¶
func (e SimpleEntry) Warn(args ...interface{}) *Event
Warn outputs log with level WarnLevel.
func (SimpleEntry) Warnf ¶
func (e SimpleEntry) Warnf(format string, args ...interface{}) *Event
Warnf outputs log with level WarnLevel.
func (SimpleEntry) Warnw ¶ added in v1.1.1
func (e SimpleEntry) Warnw(fields ...Field) *Event
Warnw outputs log with level WarnLevel.
func (SimpleEntry) WithContext ¶
func (e SimpleEntry) WithContext(ctx context.Context) ContextEntry
func (SimpleEntry) WithSkip ¶
func (e SimpleEntry) WithSkip(n int) SimpleEntry
func (SimpleEntry) WithTag ¶
func (e SimpleEntry) WithTag(tag string) SimpleEntry
type StringValue ¶ added in v1.1.1
type StringValue string
func (StringValue) Encode ¶ added in v1.1.1
func (v StringValue) Encode(enc Encoder) error
type StringsValue ¶ added in v1.1.1
type StringsValue []string
func (StringsValue) Encode ¶ added in v1.1.1
func (v StringsValue) Encode(enc Encoder) error
type TagFilter ¶ added in v1.1.1
type TagFilter struct {
BaseFilter
Prefix string `PluginAttribute:"prefix,default="`
Suffix string `PluginAttribute:"suffix,default="`
Tag string `PluginAttribute:"tag,default="`
// contains filtered or unexported fields
}
type TimeFilter ¶
type TimeFilter struct {
BaseFilter
Timezone string `PluginAttribute:"timezone,default=Local"`
Start string `PluginAttribute:"start"`
End string `PluginAttribute:"end"`
TimeFunc func() time.Time
// contains filtered or unexported fields
}
TimeFilter filters events that fall within a specified time period in each day.
func (*TimeFilter) Filter ¶
func (f *TimeFilter) Filter(level Level, e Entry, fields []Field) Result
func (*TimeFilter) Init ¶
func (f *TimeFilter) Init() error
type Uint16sValue ¶ added in v1.1.1
type Uint16sValue []uint16
func (Uint16sValue) Encode ¶ added in v1.1.1
func (v Uint16sValue) Encode(enc Encoder) error
type Uint32sValue ¶ added in v1.1.1
type Uint32sValue []uint32
func (Uint32sValue) Encode ¶ added in v1.1.1
func (v Uint32sValue) Encode(enc Encoder) error
type Uint64Value ¶ added in v1.1.1
type Uint64Value uint64
func (Uint64Value) Encode ¶ added in v1.1.1
func (v Uint64Value) Encode(enc Encoder) error
type Uint64sValue ¶ added in v1.1.1
type Uint64sValue []uint64
func (Uint64sValue) Encode ¶ added in v1.1.1
func (v Uint64sValue) Encode(enc Encoder) error
type Uint8sValue ¶ added in v1.1.1
type Uint8sValue []uint8
func (Uint8sValue) Encode ¶ added in v1.1.1
func (v Uint8sValue) Encode(enc Encoder) error
type UintsValue ¶ added in v1.1.1
type UintsValue []uint
func (UintsValue) Encode ¶ added in v1.1.1
func (v UintsValue) Encode(enc Encoder) error
type Writer ¶
Writer is io.Writer with a name and a Stop method.
func NewFileWriter ¶
NewFileWriter returns a FileWriter that a Writer implementation.