Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKeyVals ¶
GetKeyVals returns the logging keyvals from the given context if there are any
Types ¶
type Context ¶
Context is a wrapper around context.Context that allows to append keyvals to the context.
func Append ¶
Append adds the given keyval pair to the given context. If the context already stores keyvals, the new ones get appended. This should be used to track the logging context across the application.
func AppendKeyVals ¶
AppendKeyVals adds the given keyvals to the given context. If the context already stores keyvals, the new ones get appended. Use Append instead if you only want to add a single keyval pair. This should be used to track the logging context across the application.
type Logger ¶
type Logger interface { Debug(msg string) Debugf(format string, a ...any) Info(msg string) Infof(format string, a ...any) Error(msg string) Errorf(format string, a ...any) }
Logger is a simple interface to log at three log levels with additional formatting methods for convenience
func FromCtx ¶
FromCtx reads logging keyvals from the given context if there are any and adds them to any logs the returned Logger puts out
func With ¶
With returns a logger that adds the given keyval pair to any logs it puts out. This should be used for immediate log enrichment, for tracking of a logging context across the application use Append
func WithKeyVals ¶
WithKeyVals returns a logger that adds the given keyvals to any logs it puts out. This should be used for immediate log enrichment, for tracking of a logging context across the application use AppendKeyVals