Documentation
¶
Index ¶
- Variables
- type Context
- func (c Context) Any(key string, i interface{}) Context
- func (c Context) Bool(key string, b bool) Context
- func (c Context) Bools(key string, b []bool) Context
- func (c Context) CallerWithSkipFrameCount(count int) Context
- func (c Context) Ctx(ctx context.Context) Context
- func (c Context) Debug(args ...interface{})
- func (c Context) Debugf(format string, args ...interface{})
- func (c Context) Dur(key string, d time.Duration) Context
- func (c Context) Durs(key string, d []time.Duration) Context
- func (c Context) Err(err error) Context
- func (c Context) Error(args ...interface{})
- func (c Context) Errorf(format string, args ...interface{})
- func (c Context) Errs(key string, errs []error) Context
- func (c Context) Fatal(args ...interface{})
- func (c Context) Fatalf(format string, args ...interface{})
- func (c Context) Fields(fields interface{}) Context
- func (c Context) Float32(key string, f float32) Context
- func (c Context) Float64(key string, f float64) Context
- func (c Context) Floats32(key string, f []float32) Context
- func (c Context) Floats64(key string, f []float64) Context
- func (c Context) IPAddr(key string, ip net.IP) Context
- func (c Context) IPPrefix(key string, pfx net.IPNet) Context
- func (c Context) Info(args ...interface{})
- func (c Context) Infof(format string, args ...interface{})
- func (c Context) Int(key string, i int) Context
- func (c Context) Int8(key string, i int8) Context
- func (c Context) Int16(key string, i int16) Context
- func (c Context) Int32(key string, i int32) Context
- func (c Context) Int64(key string, i int64) Context
- func (c Context) Interface(key string, i interface{}) Context
- func (c Context) Ints(key string, i []int) Context
- func (c Context) Ints8(key string, i []int8) Context
- func (c Context) Ints16(key string, i []int16) Context
- func (c Context) Ints32(key string, i []int32) Context
- func (c Context) Ints64(key string, i []int64) Context
- func (c Context) Logger() NgrZeroLogger
- func (c Context) MACAddr(key string, ha net.HardwareAddr) Context
- func (c Context) Panic(args ...interface{})
- func (c Context) Panicf(format string, args ...interface{})
- func (c Context) Str(key, val string) Context
- func (c Context) Stringer(key string, val fmt.Stringer) Context
- func (c Context) Strs(key string, vals []string) Context
- func (c Context) Time(key string, t time.Time) Context
- func (c Context) Times(key string, t []time.Time) Context
- func (c Context) Trace(args ...interface{})
- func (c Context) Tracef(format string, args ...interface{})
- func (c Context) Type(key string, val interface{}) Context
- func (c Context) Uint(key string, i uint) Context
- func (c Context) Uint8(key string, i uint8) Context
- func (c Context) Uint16(key string, i uint16) Context
- func (c Context) Uint32(key string, i uint32) Context
- func (c Context) Uint64(key string, i uint64) Context
- func (c Context) Uints(key string, i []uint) Context
- func (c Context) Uints8(key string, i []uint8) Context
- func (c Context) Uints16(key string, i []uint16) Context
- func (c Context) Uints32(key string, i []uint32) Context
- func (c Context) Uints64(key string, i []uint64) Context
- func (c Context) Warn(args ...interface{})
- func (c Context) Warnf(format string, args ...interface{})
- func (c Context) Warning(args ...interface{})
- func (c Context) Warningf(format string, args ...interface{})
- type NgrZeroLogger
- func (l *NgrZeroLogger) AddOutput(key string, w io.Writer)
- func (l NgrZeroLogger) Debug(args ...interface{})
- func (l NgrZeroLogger) Debugf(format string, args ...interface{})
- func (l NgrZeroLogger) Error(args ...interface{})
- func (l NgrZeroLogger) Errorf(format string, args ...interface{})
- func (l NgrZeroLogger) Fatal(args ...interface{})
- func (l NgrZeroLogger) Fatalf(format string, args ...interface{})
- func (l NgrZeroLogger) Info(args ...interface{})
- func (l NgrZeroLogger) Infof(format string, args ...interface{})
- func (l *NgrZeroLogger) Level(lvl zerolog.Level) NgrZeroLogger
- func (l NgrZeroLogger) Panic(args ...interface{})
- func (l NgrZeroLogger) Panicf(format string, args ...interface{})
- func (l NgrZeroLogger) Print(args ...interface{})
- func (l NgrZeroLogger) Printf(format string, args ...interface{})
- func (l NgrZeroLogger) Println(args ...interface{})
- func (l *NgrZeroLogger) RemoveOutput(key string)
- func (l *NgrZeroLogger) SetOutput(w io.Writer)
- func (l NgrZeroLogger) Trace(args ...interface{})
- func (l NgrZeroLogger) Tracef(format string, args ...interface{})
- func (l NgrZeroLogger) Warn(args ...interface{})
- func (l NgrZeroLogger) Warnf(format string, args ...interface{})
- func (l NgrZeroLogger) Warning(args ...interface{})
- func (l NgrZeroLogger) Warningf(format string, args ...interface{})
- func (l *NgrZeroLogger) With() Context
- func (l NgrZeroLogger) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
var Log = NewLogger("", "", "", "", "")
Log - Default logger
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (Context) CallerWithSkipFrameCount ¶ added in v2.0.2
CallerWithSkipFrameCount adds the file:line of the caller with the zerolog.CallerFieldName key. The specified skipFrameCount int will override the global CallerSkipFrameCount for this context's respective logger. Usually needed in case the logger is wrapped. If set to -1 the global CallerSkipFrameCount will be used.
func (Context) Ctx ¶
Ctx adds the context.Context to the logger context. The context.Context is not rendered in the error message, but is made available for hooks to use. A typical use case is to extract tracing information from the context.Context.
func (Context) Dur ¶ added in v2.0.1
Dur adds the fields key with d divided by unit and stored as a float.
func (Context) Durs ¶ added in v2.0.1
Durs adds the fields key with d divided by unit and stored as a float.
func (Context) Errs ¶
Errs adds the field key with errs as an array of serialized errors to the logger context.
func (Context) Fields ¶
Fields is a helper function to use a map or slice to set fields using type assertion. Only map[string]interface{} and []interface{} are accepted. []interface{} must alternate string keys and arbitrary values, and extraneous ones are ignored.
func (Context) Logger ¶
func (c Context) Logger() NgrZeroLogger
Logger returns the logger with the context previously set.
func (Context) MACAddr ¶
func (c Context) MACAddr(key string, ha net.HardwareAddr) Context
MACAddr adds MAC address to the context
func (Context) Stringer ¶
Stringer adds the field key with val.String() (or null if val is nil) to the logger context.
func (Context) Time ¶
Time adds the field key with t formatted as string using zerolog.TimeFieldFormat.
func (Context) Times ¶
Times adds the field key with t formatted as string using zerolog.TimeFieldFormat.
type NgrZeroLogger ¶
type NgrZeroLogger struct {
Product string
Component string
Version string
Hostname string
Address string
ShowProduct atomic.Bool
ShowComponent atomic.Bool
ShowVersion atomic.Bool
ShowHostname atomic.Bool
ShowAddress atomic.Bool
// contains filtered or unexported fields
}
func NewLogger ¶
func NewLogger(product, component, version, hostname, address string) NgrZeroLogger
func (NgrZeroLogger) Debug ¶
func (l NgrZeroLogger) Debug(args ...interface{})
func (NgrZeroLogger) Debugf ¶
func (l NgrZeroLogger) Debugf(format string, args ...interface{})
func (NgrZeroLogger) Error ¶
func (l NgrZeroLogger) Error(args ...interface{})
func (NgrZeroLogger) Errorf ¶
func (l NgrZeroLogger) Errorf(format string, args ...interface{})
func (NgrZeroLogger) Fatal ¶
func (l NgrZeroLogger) Fatal(args ...interface{})
func (NgrZeroLogger) Fatalf ¶
func (l NgrZeroLogger) Fatalf(format string, args ...interface{})
func (NgrZeroLogger) Info ¶
func (l NgrZeroLogger) Info(args ...interface{})
func (NgrZeroLogger) Infof ¶
func (l NgrZeroLogger) Infof(format string, args ...interface{})
func (*NgrZeroLogger) Level ¶
func (l *NgrZeroLogger) Level(lvl zerolog.Level) NgrZeroLogger
Level creates a child logger with the minimum accepted level set to level.
func (NgrZeroLogger) Panic ¶
func (l NgrZeroLogger) Panic(args ...interface{})
func (NgrZeroLogger) Panicf ¶
func (l NgrZeroLogger) Panicf(format string, args ...interface{})
func (NgrZeroLogger) Print ¶ added in v2.0.1
func (l NgrZeroLogger) Print(args ...interface{})
Print sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Print.
func (NgrZeroLogger) Printf ¶ added in v2.0.1
func (l NgrZeroLogger) Printf(format string, args ...interface{})
Printf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func (NgrZeroLogger) Println ¶ added in v2.0.1
func (l NgrZeroLogger) Println(args ...interface{})
Println sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Println.
func (*NgrZeroLogger) RemoveOutput ¶
func (l *NgrZeroLogger) RemoveOutput(key string)
RemoveOutput removes output by key
func (*NgrZeroLogger) SetOutput ¶
func (l *NgrZeroLogger) SetOutput(w io.Writer)
func (NgrZeroLogger) Trace ¶
func (l NgrZeroLogger) Trace(args ...interface{})
func (NgrZeroLogger) Tracef ¶
func (l NgrZeroLogger) Tracef(format string, args ...interface{})
func (NgrZeroLogger) Warn ¶
func (l NgrZeroLogger) Warn(args ...interface{})
func (NgrZeroLogger) Warnf ¶
func (l NgrZeroLogger) Warnf(format string, args ...interface{})
func (NgrZeroLogger) Warning ¶
func (l NgrZeroLogger) Warning(args ...interface{})
func (NgrZeroLogger) Warningf ¶
func (l NgrZeroLogger) Warningf(format string, args ...interface{})
func (*NgrZeroLogger) With ¶
func (l *NgrZeroLogger) With() Context