Documentation ¶
Overview ¶
Package log contains the logging subsystem of PGK
Index ¶
- Constants
- func AddUUID(ctx context.Context) (context.Context, error)
- func Debug(msg string, keysAndValues ...interface{})
- func Enabled() bool
- func Error(err error, msg string, keysAndValues ...interface{})
- func Info(msg string, keysAndValues ...interface{})
- func IntoContext(ctx context.Context, log Logger) context.Context
- func SetLogger(logr logr.Logger)
- func Trace(msg string, keysAndValues ...interface{})
- func Warning(msg string, keysAndValues ...interface{})
- type Logger
Constants ¶
const ( // ErrorLevelString is the string representation of the error level ErrorLevelString = "error" // ErrorLevel is the error level priority ErrorLevel = zapcore.ErrorLevel // InfoLevelString is the string representation of the info level InfoLevelString = "info" // InfoLevel is the info level priority InfoLevel = zapcore.InfoLevel // DebugLevelString is the string representation of the debug level DebugLevelString = "debug" // DebugLevel is the debug level priority DebugLevel zapcore.Level = -2 // TraceLevelString is the string representation of the trace level TraceLevelString = "trace" // TraceLevel is the trace level priority TraceLevel zapcore.Level = -4 // WarningLevelString is the string representation of the warning level WarningLevelString = "warning" // WarningLevel is the warning level priority WarningLevel = zapcore.WarnLevel // DefaultLevelString is the string representation of the default level DefaultLevelString = InfoLevelString // DefaultLevel is the default logging level DefaultLevel = InfoLevel )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(msg string, keysAndValues ...interface{})
Debug exposes the same method from the logr.Logger interface using the default logger
func Enabled ¶
func Enabled() bool
Enabled exposes the same method from the logr.Logger interface using the default logger
func Info ¶
func Info(msg string, keysAndValues ...interface{})
Info exposes the same method from the logr.Logger interface using the default logger
func IntoContext ¶
IntoContext injects a logger into a context
Types ¶
type Logger ¶
type Logger interface { Enabled() bool Error(err error, msg string, keysAndValues ...interface{}) Warning(msg string, keysAndValues ...interface{}) Info(msg string, keysAndValues ...interface{}) Debug(msg string, keysAndValues ...interface{}) Trace(msg string, keysAndValues ...interface{}) WithCaller() Logger WithValues(keysAndValues ...interface{}) Logger WithName(name string) Logger GetLogger() logr.Logger }
Logger is a reduced version of logr.Logger
func FromContext ¶
FromContext builds a logger with some additional information stored in the context
func SetupLogger ¶
SetupLogger sets up the logger from a given context, wrapping it with a new uuid, and any given name
func WithCaller ¶
func WithCaller() Logger
WithCaller exposes the same method from logr.Logger interface using the default logger
func WithName ¶
WithName exposes the same method from the logr.Logger interface using the default logger
func WithValues ¶
func WithValues(keysAndValues ...interface{}) Logger
WithValues exposes the same method from the logr.Logger interface using the default logger