logging

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Overview

Package logging provides loggers for Kopia.

Index

Constants

This section is empty.

Variables

View Source
var NullLogger = zap.NewNop().Sugar()

NullLogger represents a singleton logger that discards all output. nolint:gochecknoglobals

Functions

func AlsoLogTo added in v0.9.5

func AlsoLogTo(ctx context.Context, loggers ...Logger) context.Context

AlsoLogTo returns a context where all logging is emitted the the original output plus the provided loggers.

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 Buffer added in v0.11.0

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer is a specialized buffer that can be kept in a pool used for constructing logging messages without allocation.

func GetBuffer added in v0.11.0

func GetBuffer() *Buffer

GetBuffer gets a logging buffer.

func (*Buffer) AppendBoolean added in v0.11.0

func (b *Buffer) AppendBoolean(val bool) *Buffer

AppendBoolean appends boolean string ("true" or "false").

func (*Buffer) AppendByte added in v0.11.0

func (b *Buffer) AppendByte(val byte) *Buffer

AppendByte appends a single byte/character.

func (*Buffer) AppendBytes added in v0.11.0

func (b *Buffer) AppendBytes(val []byte) *Buffer

AppendBytes appends a slice of bytes.

func (*Buffer) AppendInt added in v0.11.0

func (b *Buffer) AppendInt(val int64, base int) *Buffer

AppendInt appends integer value formatted as a string in a given base.

func (*Buffer) AppendInt32 added in v0.11.0

func (b *Buffer) AppendInt32(val int32) *Buffer

AppendInt32 appends int32 value formatted as a decimal string.

func (*Buffer) AppendInt64 added in v0.11.0

func (b *Buffer) AppendInt64(val int64) *Buffer

AppendInt64 appends int64 value formatted as a decimal string.

func (*Buffer) AppendString added in v0.11.0

func (b *Buffer) AppendString(val string) *Buffer

AppendString appends a string of characters.

func (*Buffer) AppendTime added in v0.11.0

func (b *Buffer) AppendTime(val time.Time, layout string) *Buffer

AppendTime appends a time representation.

func (*Buffer) AppendUint added in v0.11.0

func (b *Buffer) AppendUint(val uint64, base int) *Buffer

AppendUint appends unsigned integer value formatted as a string in a given base.

func (*Buffer) AppendUint32 added in v0.11.0

func (b *Buffer) AppendUint32(val uint32) *Buffer

AppendUint32 appends uint32 value formatted as a decimal string.

func (*Buffer) AppendUint64 added in v0.11.0

func (b *Buffer) AppendUint64(val uint64) *Buffer

AppendUint64 appends uint64 value formatted as a decimal string.

func (*Buffer) Release added in v0.11.0

func (b *Buffer) Release()

Release releases logging buffer back to the pool.

func (*Buffer) Reset added in v0.11.0

func (b *Buffer) Reset()

Reset resets logging buffer back to zero length.

func (*Buffer) String added in v0.11.0

func (b *Buffer) String() (s string)

String returns a string value of a buffer. The value is valud as long as string remains allocated and no Append*() methods have been called.

type Logger

type Logger = *zap.SugaredLogger

Logger is used by Kopia to emit various logs.

func Broadcast added in v0.9.0

func Broadcast(logger ...Logger) Logger

Broadcast is a logger that broadcasts each log message to multiple loggers.

type LoggerFactory added in v0.9.1

type LoggerFactory func(module string) Logger

LoggerFactory retrieves a named logger for a given module.

func ToWriter added in v0.11.0

func ToWriter(w io.Writer) LoggerFactory

ToWriter returns LoggerFactory that uses given writer for log output (unadorned).

Jump to

Keyboard shortcuts

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