Documentation ¶
Index ¶
- func AddObject[T zerolog.LogObjectMarshaler](arr *zerolog.Array, obj T)
- func AddStr[T ~string](arr *zerolog.Array, str T)
- func AddStringer[T fmt.Stringer](arr *zerolog.Array, str T)
- func ArrayOf[T any](slice []T, fn func(arr *zerolog.Array, item T)) *zerolog.Array
- func ArrayOfObjs[T zerolog.LogObjectMarshaler](slice []T) *zerolog.Array
- func ArrayOfStringers[T fmt.Stringer](slice []T) *zerolog.Array
- func ArrayOfStrs[T ~string](slice []T) *zerolog.Array
- func CallerWithFunctionName(pc uintptr, file string, line int) string
- func SetupDefaults(log *zerolog.Logger)
- type LogWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayOfObjs ¶
func ArrayOfObjs[T zerolog.LogObjectMarshaler](slice []T) *zerolog.Array
func ArrayOfStrs ¶
func CallerWithFunctionName ¶
CallerWithFunctionName is an implementation for zerolog.CallerMarshalFunc that includes the caller function name in addition to the file and line number.
Use as
zerolog.CallerMarshalFunc = exzerolog.CallerWithFunctionName
func SetupDefaults ¶
SetupDefaults updates zerolog globals with sensible defaults.
* zerolog.TimeFieldFormat is set to time.RFC3339Nano instead of time.RFC3339 * zerolog.CallerMarshalFunc is set to CallerWithFunctionName * zerolog.DefaultContextLogger is set to the given logger with default_context_log=true and caller info enabled * The global default log.Logger is set to the given logger with global_log=true and caller info enabled * zerolog.LevelColors are updated to swap trace and debug level colors
Types ¶
type LogWriter ¶
type LogWriter struct {
// contains filtered or unexported fields
}
LogWriter wraps a zerolog.Logger and provides an io.Writer with buffering so each written line is logged separately.