Documentation ¶
Overview ¶
Package logging provides loggers for Kopia.
Index ¶
- Variables
- func AlsoLogTo(ctx context.Context, loggers ...Logger) context.Context
- func Module(module string) func(ctx context.Context) Logger
- func WithLogger(ctx context.Context, l LoggerFactory) context.Context
- type Buffer
- func (b *Buffer) AppendBoolean(val bool) *Buffer
- func (b *Buffer) AppendByte(val byte) *Buffer
- func (b *Buffer) AppendBytes(val []byte) *Buffer
- func (b *Buffer) AppendInt(val int64, base int) *Buffer
- func (b *Buffer) AppendInt32(val int32) *Buffer
- func (b *Buffer) AppendInt64(val int64) *Buffer
- func (b *Buffer) AppendString(val string) *Buffer
- func (b *Buffer) AppendTime(val time.Time, layout string) *Buffer
- func (b *Buffer) AppendUint(val uint64, base int) *Buffer
- func (b *Buffer) AppendUint32(val uint32) *Buffer
- func (b *Buffer) AppendUint64(val uint64) *Buffer
- func (b *Buffer) Release()
- func (b *Buffer) Reset()
- func (b *Buffer) String() (s string)
- type Logger
- type LoggerFactory
Constants ¶
This section is empty.
Variables ¶
var NullLogger = zap.NewNop().Sugar()
NullLogger represents a singleton logger that discards all output.
Functions ¶
func AlsoLogTo ¶ added in v0.9.5
AlsoLogTo returns a context where all logging is emitted the original output plus the provided loggers.
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 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 (*Buffer) AppendBoolean ¶ added in v0.11.0
AppendBoolean appends boolean string ("true" or "false").
func (*Buffer) AppendByte ¶ added in v0.11.0
AppendByte appends a single byte/character.
func (*Buffer) AppendBytes ¶ added in v0.11.0
AppendBytes appends a slice of bytes.
func (*Buffer) AppendInt ¶ added in v0.11.0
AppendInt appends integer value formatted as a string in a given base.
func (*Buffer) AppendInt32 ¶ added in v0.11.0
AppendInt32 appends int32 value formatted as a decimal string.
func (*Buffer) AppendInt64 ¶ added in v0.11.0
AppendInt64 appends int64 value formatted as a decimal string.
func (*Buffer) AppendString ¶ added in v0.11.0
AppendString appends a string of characters.
func (*Buffer) AppendTime ¶ added in v0.11.0
AppendTime appends a time representation.
func (*Buffer) AppendUint ¶ added in v0.11.0
AppendUint appends unsigned integer value formatted as a string in a given base.
func (*Buffer) AppendUint32 ¶ added in v0.11.0
AppendUint32 appends uint32 value formatted as a decimal string.
func (*Buffer) AppendUint64 ¶ added in v0.11.0
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.
type LoggerFactory ¶ added in v0.9.1
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).