A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pkg.go.dev/github.com/go-logr/zerologr below:

zerologr package - github.com/go-logr/zerologr - Go Packages

Package zerologr defines an implementation of the github.com/go-logr/logr interfaces built on top of Zerolog (https://github.com/rs/zerolog).

Usage

A new logr.Logger can be constructed from an existing zerolog.Logger using the New function:

log := zerologr.New(someZeroLogger)
Implementation Details

For the most part, concepts in Zerolog correspond directly with those in logr.

V-levels in logr correspond to levels in Zerolog as `zerologLevel = 1 - logrV`. `logr.V(0)` is equivalent to `zerolog.InfoLevel` or 1; `logr.V(1)` is equivalent to `zerolog.DebugLevel` or 0 (default global level in Zerolog); `logr.V(2)` is equivalent to `zerolog.TraceLevel` or -1. Higher than 2 V-level is possible but misses some features in Zerolog, e.g. Hooks and Sampling. V-level value is a number and is only logged on Info(), not Error().

This section is empty.

func DefaultRender(keysAndValues []interface{}) []interface{}

DefaultRender supports logr.Marshaler and fmt.Stringer.

SetMaxV updates Zerolog's global level. Default max V-level is 1 (DebugLevel). The range of max V-level is 0 through 129 inclusive, but higher than 2 V-level misses some features in Zerolog, e.g. Hooks and Sampling.

LogSink implements logr.LogSink and logr.CallDepthLogSink.

NewLogSink returns a logr.LogSink implemented by Zerolog.

Enabled tests whether this LogSink is enabled at the specified V-level.

Error logs an error, with the given message and key/value pairs as context.

GetUnderlying returns the zerolog.Logger underneath this logSink.

Info logs a non-error message at specified V-level with the given key/value pairs as context.

Init receives runtime info about the logr library.

WithCallDepth returns a new LogSink that offsets the call stack by adding specified depths.

WithName returns a new LogSink with the specified name appended in NameFieldName. Name elements are separated by NameSeparator.

WithValues returns a new LogSink with additional key/value pairs.

Logger is type alias of logr.Logger.

New returns a logr.Logger with logr.LogSink implemented by Zerolog. Local level is mutated to allow max V-level if not set explicitly, so SetMaxV alone can control Zerolog's level. Use NewLogSink directly if local level mutation is undesirable.

Underlier exposes access to the underlying logging implementation. Since callers only have a logr.Logger, they have to know which implementation is in use, so this interface is less of an abstraction and more of way to test type conversion.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4