Documentation ¶
Index ¶
- Variables
- func SetGlobalLogger(logger Logger)
- type AA
- type BB
- type Event
- type Field
- type JsonLogger
- func (p JsonLogger) AppendTo(b *ByteSlice)
- func (l *JsonLogger) Copy() *JsonLogger
- func (l *JsonLogger) Error(vs ...interface{})
- func (l *JsonLogger) Info(vs ...interface{})
- func (l *JsonLogger) Infof(format string, vs ...interface{})
- func (l *JsonLogger) Warn(vs ...interface{})
- func (l *JsonLogger) WithCallerSkip(skip int) *JsonLogger
- func (l *JsonLogger) WithFieldsAtBack(fields ...Field) *JsonLogger
- func (l *JsonLogger) WithFieldsAtFront(fields ...Field) *JsonLogger
- func (l *JsonLogger) WithLogLevel(level Level) *JsonLogger
- func (l *JsonLogger) WithWriter(w io.Writer) *JsonLogger
- type Level
- type LevelWriter
- type Logger
- type TextLogger
- func (p TextLogger) AppendTo(b *ByteSlice)
- func (l *TextLogger) Copy() *TextLogger
- func (l *TextLogger) Error(vs ...interface{})
- func (l *TextLogger) Info(vs ...interface{})
- func (l *TextLogger) Infof(format string, vs ...interface{})
- func (l *TextLogger) Warn(vs ...interface{})
- func (l *TextLogger) WithCallerSkip(skip int) *TextLogger
- func (l *TextLogger) WithFieldsAtBack(fields ...TextLoggerField) *TextLogger
- func (l *TextLogger) WithFieldsAtFront(fields ...TextLoggerField) *TextLogger
- func (l *TextLogger) WithLogLevel(level Level) *TextLogger
- func (l *TextLogger) WithWriter(w io.Writer) *TextLogger
- type TextLoggerField
- type TimeFormatFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // FieldCaller adds a caller field. // To set caller skip level, use WithCallerSkip. FieldCaller fieldCaller FieldLevel fieldLevel FieldTime fieldTime FieldTimestamp TimeFormatFunc = func(t time.Time) string { return strconv.FormatInt(t.Unix(), 10) } FieldTimestampNano TimeFormatFunc = func(t time.Time) string { return strconv.FormatInt(t.UnixNano(), 10) } )
View Source
var ( LevelMap = map[Level]string{ LevelDebug: "debug", LevelInfo: "info", LevelWarn: "warn", LevelError: "error", LevelFatal: "fatal", LevelUnknown: "unknown", } )
Functions ¶
func SetGlobalLogger ¶
func SetGlobalLogger(logger Logger)
Types ¶
type JsonLogger ¶
type JsonLogger struct {
// contains filtered or unexported fields
}
func NewJsonLogger ¶
func NewJsonLogger() *JsonLogger
func (JsonLogger) AppendTo ¶
func (p JsonLogger) AppendTo(b *ByteSlice)
func (*JsonLogger) Copy ¶
func (l *JsonLogger) Copy() *JsonLogger
func (*JsonLogger) Error ¶
func (l *JsonLogger) Error(vs ...interface{})
func (*JsonLogger) Info ¶
func (l *JsonLogger) Info(vs ...interface{})
func (*JsonLogger) Infof ¶
func (l *JsonLogger) Infof(format string, vs ...interface{})
func (*JsonLogger) Warn ¶
func (l *JsonLogger) Warn(vs ...interface{})
func (*JsonLogger) WithCallerSkip ¶
func (l *JsonLogger) WithCallerSkip(skip int) *JsonLogger
func (*JsonLogger) WithFieldsAtBack ¶
func (l *JsonLogger) WithFieldsAtBack(fields ...Field) *JsonLogger
func (*JsonLogger) WithFieldsAtFront ¶
func (l *JsonLogger) WithFieldsAtFront(fields ...Field) *JsonLogger
func (*JsonLogger) WithLogLevel ¶
func (l *JsonLogger) WithLogLevel(level Level) *JsonLogger
func (*JsonLogger) WithWriter ¶
func (l *JsonLogger) WithWriter(w io.Writer) *JsonLogger
type LevelWriter ¶
type LevelWriter interface { Write(p []byte) (int, error) WriteLevel(level Level, p []byte) (int, error) }
LevelWriter is a concept "copied" from logrus. We provide a builtin type wtfLevelWriter to implement this interface. Use NewLevelWriter in the logger if needed.
func NewLevelWriter ¶
NewLevelWriter inits a level writer with defaultWriter and levelWriterMap. If levelWriterMap is nil or empty then all messages are logged to defaultWriter. If you only want to log all to stdout/stderr, use WithWriter(os.Stdout/os.Stderr) directly.
type Logger ¶
type Logger interface { Info(vs ...interface{}) Warn(vs ...interface{}) Error(vs ...interface{}) }
func GlobalLogger ¶
func GlobalLogger() Logger
type TextLogger ¶
type TextLogger struct {
// contains filtered or unexported fields
}
func (TextLogger) AppendTo ¶
func (p TextLogger) AppendTo(b *ByteSlice)
func (*TextLogger) Copy ¶
func (l *TextLogger) Copy() *TextLogger
func (*TextLogger) Error ¶
func (l *TextLogger) Error(vs ...interface{})
func (*TextLogger) Info ¶
func (l *TextLogger) Info(vs ...interface{})
func (*TextLogger) Infof ¶
func (l *TextLogger) Infof(format string, vs ...interface{})
func (*TextLogger) Warn ¶
func (l *TextLogger) Warn(vs ...interface{})
func (*TextLogger) WithCallerSkip ¶
func (l *TextLogger) WithCallerSkip(skip int) *TextLogger
func (*TextLogger) WithFieldsAtBack ¶
func (l *TextLogger) WithFieldsAtBack(fields ...TextLoggerField) *TextLogger
func (*TextLogger) WithFieldsAtFront ¶
func (l *TextLogger) WithFieldsAtFront(fields ...TextLoggerField) *TextLogger
func (*TextLogger) WithLogLevel ¶
func (l *TextLogger) WithLogLevel(level Level) *TextLogger
func (*TextLogger) WithWriter ¶
func (l *TextLogger) WithWriter(w io.Writer) *TextLogger
type TextLoggerField ¶
type TimeFormatFunc ¶
func (TimeFormatFunc) ApplyTo ¶
func (fn TimeFormatFunc) ApplyTo(e Event) string
func (TimeFormatFunc) Key ¶
func (TimeFormatFunc) Key() string
func (TimeFormatFunc) Prefix ¶
func (fn TimeFormatFunc) Prefix() string
func (TimeFormatFunc) Suffix ¶
func (fn TimeFormatFunc) Suffix() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.