logging

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package logging provides loggers for Kopia.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module added in v0.9.1

func Module(module string) func(ctx context.Context) Logger

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.

func (Broadcast) Debugf added in v0.9.0

func (b Broadcast) Debugf(msg string, args ...interface{})

Debugf implements Logger.

func (Broadcast) Errorf added in v0.9.0

func (b Broadcast) Errorf(msg string, args ...interface{})

Errorf implements Logger.

func (Broadcast) Infof added in v0.9.0

func (b Broadcast) Infof(msg string, args ...interface{})

Infof implements Logger.

func (Broadcast) Warnf added in v0.9.1

func (b Broadcast) Warnf(msg string, args ...interface{})

Warnf implements Logger.

type Logger

type Logger interface {
	Debugf(msg string, args ...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 WithPrefix added in v0.9.0

func WithPrefix(prefix string, logger Logger) Logger

WithPrefix returns a wrapper logger that attaches given prefix to each message.

type LoggerFactory added in v0.9.1

type LoggerFactory func(module string) Logger

LoggerFactory retrieves logger for a given module.

func Printf

func Printf(printf func(msg string, args ...interface{})) LoggerFactory

Printf 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL