Documentation ¶
Index ¶
- type Log
- func (l Log) Debug(i ...interface{})
- func (l Log) Debugf(format string, i ...interface{})
- func (l Log) Debugj(j log.JSON)
- func (l Log) Error(i ...interface{})
- func (l Log) Errorf(format string, i ...interface{})
- func (l Log) Errorj(j log.JSON)
- func (l Log) Fatal(i ...interface{})
- func (l Log) Fatalf(format string, i ...interface{})
- func (l Log) Fatalj(j log.JSON)
- func (l Log) Info(i ...interface{})
- func (l Log) Infof(format string, i ...interface{})
- func (l Log) Infoj(j log.JSON)
- func (l Log) Level() log.Lvl
- func (l Log) Output() io.Writer
- func (l Log) Panic(i ...interface{})
- func (l Log) Panicf(format string, i ...interface{})
- func (l Log) Panicj(j log.JSON)
- func (l Log) Prefix() string
- func (l Log) Print(i ...interface{})
- func (l Log) Printf(format string, i ...interface{})
- func (l Log) Printj(j log.JSON)
- func (l *Log) SetCallsite(enabled bool)
- func (l *Log) SetHeader(h string)
- func (l *Log) SetLevel(v log.Lvl)
- func (l *Log) SetOutput(w io.Writer)
- func (l *Log) SetPrefix(prefix string)
- func (l Log) Warn(i ...interface{})
- func (l Log) Warnf(format string, i ...interface{})
- func (l Log) Warnj(j log.JSON)
- type Zero
- type ZeroEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log wraps a zerolog.Logger to provide an `echo.Logger` implementation
func New ¶
New returns a new Log instance with the given output. Pass in your own zerolog logger if required. No prefix is set; use SetPrefix if required.
func (*Log) SetCallsite ¶
SetCallsite controls whether file and line numbers are emitted with every log output. Set this true to enable these items.
func (*Log) SetHeader ¶
SetHeader satisfies the echo.Logger interface. It does nothing. Within `echo`, this is used to set the template for formatting log messages, but it is not required when using zerolog.
func (*Log) SetPrefix ¶
SetPrefix satisfies the echo.Logger interface. Not implemented: this is a no-op.
type Zero ¶
type Zero interface { // Log starts a new message with no level. Setting GlobalLevel to Disabled // will still disable events produced by this method. Log() ZeroEvent // Debug starts a new message with debug level. Debug() ZeroEvent // Info starts a new message with info level. Info() ZeroEvent // Warn starts a new message with warn level. Warn() ZeroEvent // Error starts a new message with error level. Error() ZeroEvent // Fatal starts a new message with fatal level; the program will terminate. Fatal() ZeroEvent // Panic starts a new message with panic level; there will be a panic. Panic() ZeroEvent // Err starts a new message with error level with err as a field if not nil or // with info level if err is nil. Err(err error) ZeroEvent // WithLevel starts a new message with level. Unlike Fatal and Panic // methods, WithLevel does not terminate the program or stop the ordinary // flow of a gourotine when used with their respective levels. // // You must call Msg on the returned event in order to send the event. WithLevel(level zerolog.Level) ZeroEvent // Output duplicates the current logger and sets w as its output. Output(w io.Writer) Zero // Level creates a child logger with the minimum accepted level set to level. Level(lvl zerolog.Level) Zero // Str creates a child logger with the field key and with val as a string to the logger context. Str(key, val string) Zero // Int creates a child logger with the field key and with val as an int to the logger context. Int(key string, val int) Zero // RawJSON creates a child logger with the field key with val as already encoded JSON to context. // // No sanity check is performed on b; it must not contain carriage returns and be valid JSON. RawJSON(key string, b []byte) Zero // Timestamp adds the current local time as UNIX timestamp to the logger context with the "time" key. // To customize the key name, change zerolog.TimestampFieldName. // // NOTE: It won't dedupe the "time" key if the internal context has one already. Timestamp() Zero }
Zero mimics a zerolog.Logger. It excludes Trace because it is a non-requirement here.
type ZeroEvent ¶
type ZeroEvent interface { Send() Msg(string) Msgf(format string, v ...interface{}) AnErr(key string, val error) ZeroEvent Bool(key string, val bool) ZeroEvent Bools(key string, b []bool) ZeroEvent Bytes(key string, val []byte) ZeroEvent Dict(key string, dict ZeroEvent) ZeroEvent Dur(key string, val time.Duration) ZeroEvent Err(err error) ZeroEvent Hex(key string, val []byte) ZeroEvent Int(key string, val int) ZeroEvent Ints(key string, val []int) ZeroEvent Int64(key string, val int64) ZeroEvent Interface(key string, val interface{}) ZeroEvent Str(key, val string) ZeroEvent Strs(key string, val []string) ZeroEvent Stringer(key string, val fmt.Stringer) ZeroEvent Time(key string, val time.Time) ZeroEvent Timestamp() ZeroEvent Uint(key string, val uint) ZeroEvent Uints(key string, val []uint) ZeroEvent Uint64(key string, val uint64) ZeroEvent }
ZeroEvent mimics the zerolog Event struct.