Documentation
¶
Overview ¶
Package logging provides loggers for Kopia.
Index ¶
- func AlsoLogTo(ctx context.Context, loggers ...Logger) context.Context
- func DebugMessageWithKeyValuePairs(msg string, keyValuePairs []interface{}) string
- func Module(module string) func(ctx context.Context) Logger
- func WithLogger(ctx context.Context, l LoggerFactory) context.Context
- type Broadcast
- func (b Broadcast) Debugf(msg string, args ...interface{})
- func (b Broadcast) Debugw(msg string, keyValuePairs ...interface{})
- func (b Broadcast) Errorf(msg string, args ...interface{})
- func (b Broadcast) Infof(msg string, args ...interface{})
- func (b Broadcast) Warnf(msg string, args ...interface{})
- type Logger
- type LoggerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlsoLogTo ¶ added in v0.9.5
AlsoLogTo returns a context where all logging is emitted the the original output plus the provided loggers.
func DebugMessageWithKeyValuePairs ¶ added in v0.9.5
DebugMessageWithKeyValuePairs returns a debug string consisting of alternating key:value separated by spaces and prefixed with a space.
func Module ¶ added in v0.9.1
Module returns an function that returns a logger for a given module when provided with a context.
func WithLogger ¶
func WithLogger(ctx context.Context, l LoggerFactory) context.Context
WithLogger returns a derived context with associated logger.
Types ¶
type Broadcast ¶ added in v0.9.0
type Broadcast []Logger
Broadcast is a logger that broadcasts each log message to multiple loggers.
type Logger ¶
type Logger interface { Debugf(msg string, args ...interface{}) Debugw(msg string, keyValuePairs ...interface{}) Infof(msg string, args ...interface{}) Warnf(msg string, args ...interface{}) Errorf(msg string, args ...interface{}) }
Logger is an interface used by Kopia to output logs.
func NullLogger ¶ added in v0.9.5
func NullLogger() Logger
NullLogger is a null logger that discards all log messages.
func WithPrefix ¶ added in v0.9.0
WithPrefix returns a wrapper logger that attaches given prefix to each message.
type LoggerFactory ¶ added in v0.9.1
LoggerFactory retrieves logger for a given module.
func PrintfFactory ¶ added in v0.9.5
func PrintfFactory(printf func(msg string, args ...interface{})) LoggerFactory
PrintfFactory returns LoggerForModuleFunc that uses given printf-style function to print log output.
func Writer ¶ added in v0.9.0
func Writer(w io.Writer) LoggerFactory
Writer returns LoggerForModuleFunc that uses given writer for log output.