Documentation
¶
Index ¶
- func ConfigureLogging(ctx context.Context, logWriter io.Writer) context.Context
- func CopyIntoCtx(source, target context.Context) context.Context
- func FromContext(ctx context.Context, area ...string) zerolog.Logger
- func FromContextBlank(ctx context.Context, area ...string) zerolog.Logger
- func GetCurrentSubareaPrefix(ctx context.Context) string
- func GetLevels() map[string]zerolog.Level
- func NewLogger(extraLogWriter io.Writer) zerolog.Logger
- func OverwriteLevelIfNotSet(level zerolog.Level, area ...string)
- func SetAreaSeparator(n string)
- func SetAreaToLevelSeparator(n string)
- func SetBadFormatShouldPanic(n bool)
- func SetIncludeArea(n bool)
- func SetLogDebugAreaSearch(n bool)
- func SetSubAreaSeparator(n string)
- func SetupFlags()
- func WithSubarea(ctx context.Context, subarea ...string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureLogging ¶
Configure internal base logger (with logWriter (if not nil) and stderr) at trace level Also parses the "GO_LOG" environment variable into log levels
func CopyIntoCtx ¶ added in v1.21.1
Copy the logger configuration of the source context into the target context. Useful for cases where you don't control the base context
func FromContext ¶
Get a logger from the given context, with the given area. If context has a subarea set, prepend that to the area
func FromContextBlank ¶ added in v1.23.0
Get a logger from the given context, with the given area. Ignores the context's subarea, if set
func GetCurrentSubareaPrefix ¶ added in v1.25.2
func OverwriteLevelIfNotSet ¶ added in v1.23.1
func SetAreaSeparator ¶ added in v1.26.0
func SetAreaSeparator(n string)
SetAreaSeparator configures the separator for area to level pairs. Example: the `,` in `info,example::test=info`. Defaults to "," to match Rust's `RUST_LOG` behaviour.
func SetAreaToLevelSeparator ¶ added in v1.26.0
func SetAreaToLevelSeparator(n string)
SetAreaSeparator configures the separator for each area to level. Example: the `=` in `info,example::test=info`. Defaults to "=" to match Rust's `RUST_LOG` behaviour.
func SetBadFormatShouldPanic ¶ added in v1.26.0
func SetBadFormatShouldPanic(n bool)
SetBadFormatShouldPanic configures whether a badly formatted loglevel should raise a panic. Defaults to false, where a bad value is set to info.
func SetIncludeArea ¶ added in v1.25.3
func SetIncludeArea(n bool)
SetIncludeArea configures whether the loggers returned by FromContext and FromContextBlank will append the specific area of the logger to the logger's output. Defaults to false.
func SetLogDebugAreaSearch ¶ added in v1.26.0
func SetLogDebugAreaSearch(n bool)
SetLogDebugAreaSearch configures whether the level search for the specified area (including subarea) should be logged. If true, the search will be logged at trace level, always. Defaults to false.
func SetSubAreaSeparator ¶ added in v1.26.0
func SetSubAreaSeparator(n string)
SetAreaSeparator configures the separator for each area to level. Example: the `::` in `info,example::test=info`. Defaults to "::" to match Rust's `RUST_LOG` behaviour.
func SetupFlags ¶
func SetupFlags()
func WithSubarea ¶ added in v1.21.0
Configure a new context with a given subarea for logging. The subarea will be prepended to the area given in FromContext. If a subarea is already set, the existing one is prepended to the new one
Types ¶
This section is empty.