Documentation ¶
Index ¶
- func AddGlobalFields(field string)
- func ClearGlobalFields()
- func FullCallerEncoder() func(pc uintptr, file string, line int) string
- func GetGlobalFields() []string
- func GetGoroutineID() uint64
- func LowercaseLevelEncoder() func(l zerolog.Level) string
- func ResetGlobalMdcAdapter()
- func SetGlobalFields(fields []string)
- func ShortCallerEncoder() func(pc uintptr, file string, line int) string
- func TrimmedPath(file string) string
- func UppercaseLevelEncoder() func(l zerolog.Level) string
- func Z() *zerolog.Logger
- type MDCHook
- type MdcAdapter
- func (m *MdcAdapter) Count() int
- func (m *MdcAdapter) Get(key string) (interface{}, bool)
- func (m *MdcAdapter) GetString(key string) string
- func (m *MdcAdapter) Has(key string) bool
- func (m *MdcAdapter) IsEmpty() bool
- func (m *MdcAdapter) Keys() []string
- func (m *MdcAdapter) Remove(key string)
- func (m *MdcAdapter) Set(key string, value interface{})
- func (m *MdcAdapter) SetIfAbsent(key string, value interface{}) bool
- func (m *MdcAdapter) SetMap(data map[string]interface{})
- type Overlog
- func (o *Overlog) Debug(args ...interface{})
- func (o *Overlog) Debugf(format string, args ...interface{})
- func (o *Overlog) Error(args ...interface{})
- func (o *Overlog) Errorf(format string, args ...interface{})
- func (o *Overlog) Fatal(args ...interface{})
- func (o *Overlog) Fatalf(format string, args ...interface{})
- func (o *Overlog) Info(args ...interface{})
- func (o *Overlog) Infof(format string, args ...interface{})
- func (o *Overlog) Log(args ...interface{})
- func (o *Overlog) Logf(format string, args ...interface{})
- func (o *Overlog) Panic(args ...interface{})
- func (o *Overlog) Panicf(format string, args ...interface{})
- func (o *Overlog) Print(args ...interface{})
- func (o *Overlog) Printf(format string, args ...interface{})
- func (o *Overlog) Trace(args ...interface{})
- func (o *Overlog) Tracef(format string, args ...interface{})
- func (o *Overlog) Warn(args ...interface{})
- func (o *Overlog) Warnf(format string, args ...interface{})
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddGlobalFields ¶
func AddGlobalFields(field string)
func ClearGlobalFields ¶
func ClearGlobalFields()
func GetGlobalFields ¶
func GetGlobalFields() []string
func GetGoroutineID ¶
func GetGoroutineID() uint64
func LowercaseLevelEncoder ¶
func ResetGlobalMdcAdapter ¶
func ResetGlobalMdcAdapter()
func SetGlobalFields ¶
func SetGlobalFields(fields []string)
func TrimmedPath ¶
func UppercaseLevelEncoder ¶
Types ¶
type MdcAdapter ¶
func InitGlobalMdcAdapter ¶
func InitGlobalMdcAdapter() *MdcAdapter
func MDC ¶
func MDC() *MdcAdapter
func (*MdcAdapter) Count ¶
func (m *MdcAdapter) Count() int
func (*MdcAdapter) Get ¶
func (m *MdcAdapter) Get(key string) (interface{}, bool)
func (*MdcAdapter) GetString ¶
func (m *MdcAdapter) GetString(key string) string
func (*MdcAdapter) Has ¶
func (m *MdcAdapter) Has(key string) bool
func (*MdcAdapter) IsEmpty ¶
func (m *MdcAdapter) IsEmpty() bool
func (*MdcAdapter) Keys ¶
func (m *MdcAdapter) Keys() []string
func (*MdcAdapter) Remove ¶
func (m *MdcAdapter) Remove(key string)
func (*MdcAdapter) Set ¶
func (m *MdcAdapter) Set(key string, value interface{})
func (*MdcAdapter) SetIfAbsent ¶
func (m *MdcAdapter) SetIfAbsent(key string, value interface{}) bool
func (*MdcAdapter) SetMap ¶
func (m *MdcAdapter) SetMap(data map[string]interface{})
type Overlog ¶
type Overlog struct {
// contains filtered or unexported fields
}
func NewDefault ¶
func NewDefault() *Overlog
func (*Overlog) Debug ¶
func (o *Overlog) Debug(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Debug("hello world")
Output: {"level":"debug","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Debugf ¶
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Debugf("hello %s", "world")
Output: {"level":"debug","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Error ¶
func (o *Overlog) Error(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Error(errors.New("hello world"))
Output: {"level":"error","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Errorf ¶
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Errorf("hello %s", errors.New("world"))
Output: {"level":"error","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Info ¶
func (o *Overlog) Info(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Info("hello world")
Output: {"level":"info","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Infof ¶
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Infof("hello %s", "world")
Output: {"level":"info","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Log ¶
func (o *Overlog) Log(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Log("hello world")
Output: {"x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Logf ¶
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Logf("hello %s", "world")
Output: {"x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Print ¶
func (o *Overlog) Print(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Print("hello world")
Output: {"level":"debug","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Printf ¶
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Printf("hello %s", "world")
Output: {"level":"debug","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Trace ¶
func (o *Overlog) Trace(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Trace("hello world")
Output: {"level":"trace","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Tracef ¶
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Tracef("hello %s", "world")
Output: {"level":"trace","x-correlation-id":"1234","message":"hello world"}
func (*Overlog) Warn ¶
func (o *Overlog) Warn(args ...interface{})
Example ¶
New(zerolog.New(os.Stdout)) MDC().Set("x-correlation-id", "1234") AddGlobalFields("x-correlation-id") Log().Warn("hello world")
Output: {"level":"warn","x-correlation-id":"1234","message":"hello world"}
Click to show internal directories.
Click to hide internal directories.