# README
logging
import "github.com/slosive/sloscribe/internal/logging"
Package logging uses the logr.Logger interface to integrate with different logging implementation for structured logging
Index
- func ContextWithLogger(ctx context.Context, l Logger) context.Context
- func IsValidLevel(lvl string) bool
- type Logger
- func LoggerFromContext(ctx context.Context) Logger
- func NewStandardLogger() Logger
- func (l *Logger) Debug(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(msg string, keysAndValues ...interface{})
- func (l *Logger) SetLevel(lvl string) Logger
- func (l *Logger) Warn(err error, keysAndValues ...interface{})
- func (l *Logger) WithName(name string) Logger
func ContextWithLogger
func ContextWithLogger(ctx context.Context, l Logger) context.Context
ContextWithLogger wraps the logr NewContext function
func IsValidLevel
func IsValidLevel(lvl string) bool
IsValidLevel returns true if the input level is one of the valid values ("info", "debug", "warn", "none")
type Logger
type Logger struct {
logr.Logger
*sync.Mutex
}
func LoggerFromContext
func LoggerFromContext(ctx context.Context) Logger
LoggerFromContext wraps the LoggerFromContext or creates a Zap production logger
func NewStandardLogger
func NewStandardLogger() Logger
NewStandardLogger wraps the creation of a Golang standard logger
func (*Logger) Debug
func (l *Logger) Debug(msg string, keysAndValues ...interface{})
Debug logs the message using the info debug level (1)
func (*Logger) Info
func (l *Logger) Info(msg string, keysAndValues ...interface{})
Info logs the message using the info log level (2)
func (*Logger) SetLevel
func (l *Logger) SetLevel(lvl string) Logger
SetLevel sets the global level against which all info logs will be compared. If this is greater than or equal to the "V" of the logger, the message will be logged. A higher value here means more logs will be written
func (*Logger) Warn
func (l *Logger) Warn(err error, keysAndValues ...interface{})
Warn logs the error using the warning log level (3)
func (*Logger) WithName
func (l *Logger) WithName(name string) Logger
Generated by gomarkdoc