Documentation
¶
Index ¶
- Constants
- func Debug(args ...any)
- func DebugTime(msg string, start time.Time, keyvalues ...any)
- func Debugf(template string, args ...any)
- func Debugw(msg string, keyvalues ...any)
- func EnablePanicOnError(testName string) zerolog.Logger
- func EnablePanicOnErrorWithHandler(testName string, delay time.Duration, handler func(string)) zerolog.Logger
- func Error(args ...any)
- func Errorf(template string, args ...any)
- func Errorw(err error, msg string)
- func Fatal(args ...any)
- func Fatalf(template string, args ...any)
- func Info(args ...any)
- func InfoTime(msg string, start time.Time, keyvalues ...any)
- func Infof(template string, args ...any)
- func Infow(msg string, keyvalues ...any)
- func Init(level, output string, errorOutput io.Writer)
- func Level() string
- func Logger() *zerolog.Logger
- func Monitor(msg string, args map[string]any)
- func RestoreLogger(previousLogger zerolog.Logger)
- func Warn(args ...any)
- func Warnf(template string, args ...any)
- func Warnw(msg string, keyvalues ...any)
Constants ¶
const ( LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelWarn = "warn" LogLevelError = "error" RFC3339Milli = "2006-01-02T15:04:05.000Z07:00" // like time.RFC3339Nano but with 3 fixed-width decimals )
Variables ¶
This section is empty.
Functions ¶
func EnablePanicOnError ¶
EnablePanicOnError installs a hook on the current logger that makes it panic when Error level logs occur. Returns the previous logger so it can be restored later. This is useful for integration tests to catch unexpected errors.
func EnablePanicOnErrorWithHandler ¶
func EnablePanicOnErrorWithHandler(testName string, delay time.Duration, handler func(string)) zerolog.Logger
EnablePanicOnErrorWithHandler installs a hook on the current logger that triggers the handler after the provided delay when Error level logs occur. If handler is nil, it panics with the error message.
func Monitor ¶
Monitor is a wrapper around Info that allows passing a map of key-value pairs. This is useful for structured logging and monitoring. The caller information is skipped.
func RestoreLogger ¶
RestoreLogger restores a previously saved logger, removing any hooks.
Types ¶
This section is empty.