logging

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PeerIdContextLabel       = "ctx.peer_id"
	ConnectionIdContextLabel = "ctx.connection_id"

	// StreamIdContextLabel is used to store stream ids which are request numbers interpreted so that
	// streams initiated by us have positive numbers and streams initiated by remote have negative numbers.
	StreamIdContextLabel = "ctx.stream_id"
)

Variables

This section is empty.

Functions

func AddToLoggingContext

func AddToLoggingContext(ctx context.Context, label string, value any) context.Context

Types

type ContextLogger

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

func (ContextLogger) Debug

func (l ContextLogger) Debug() Entry

func (ContextLogger) Error

func (l ContextLogger) Error() Entry

func (ContextLogger) New

func (l ContextLogger) New(name string) Logger

func (ContextLogger) Trace

func (l ContextLogger) Trace() Entry

func (ContextLogger) WithCtx

func (l ContextLogger) WithCtx(ctx context.Context) Logger

func (ContextLogger) WithError

func (l ContextLogger) WithError(err error) Logger

func (ContextLogger) WithField

func (l ContextLogger) WithField(key string, v any) Logger

type DevNullLogger

type DevNullLogger struct {
}

func NewDevNullLogger

func NewDevNullLogger() DevNullLogger

func (DevNullLogger) Debug

func (d DevNullLogger) Debug() Entry

func (DevNullLogger) Error

func (d DevNullLogger) Error() Entry

func (DevNullLogger) New

func (d DevNullLogger) New(name string) Logger

func (DevNullLogger) Trace

func (d DevNullLogger) Trace() Entry

func (DevNullLogger) WithCtx

func (d DevNullLogger) WithCtx(ctx context.Context) Logger

func (DevNullLogger) WithError

func (d DevNullLogger) WithError(err error) Logger

func (DevNullLogger) WithField

func (d DevNullLogger) WithField(key string, v any) Logger

type DevNullLoggingSystem

type DevNullLoggingSystem struct {
}

func NewDevNullLoggingSystem

func NewDevNullLoggingSystem() DevNullLoggingSystem

func (DevNullLoggingSystem) Debug

func (DevNullLoggingSystem) EnabledLevel added in v0.0.2

func (d DevNullLoggingSystem) EnabledLevel() Level

func (DevNullLoggingSystem) Error

func (DevNullLoggingSystem) Trace

type Entry added in v0.0.2

type Entry interface {
	WithError(err error) Entry
	WithField(key string, v any) Entry
	Message(msg string)
}

type Level added in v0.0.2

type Level int
const (
	LevelTrace Level = iota
	LevelDebug
	LevelError
	LevelDisabled
)

type Logger

type Logger interface {
	New(name string) Logger
	WithCtx(ctx context.Context) Logger
	WithError(err error) Logger
	WithField(key string, v any) Logger

	Error() Entry
	Debug() Entry
	Trace() Entry
}

func NewContextLogger

func NewContextLogger(logger LoggingSystem, name string) Logger

type LoggingContext

type LoggingContext map[string]any

func GetLoggingContext

func GetLoggingContext(ctx context.Context) LoggingContext

type LoggingSystem

type LoggingSystem interface {
	EnabledLevel() Level
	Error() LoggingSystemEntry
	Debug() LoggingSystemEntry
	Trace() LoggingSystemEntry
}

type LoggingSystemEntry added in v0.0.2

type LoggingSystemEntry interface {
	WithField(key string, v any) LoggingSystemEntry
	Message(msg string)
}

type LogrusLoggingSystem

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

func NewLogrusLoggingSystem

func NewLogrusLoggingSystem(logger *logrus.Logger) LogrusLoggingSystem

func (LogrusLoggingSystem) Debug

func (LogrusLoggingSystem) EnabledLevel added in v0.0.2

func (t LogrusLoggingSystem) EnabledLevel() Level

func (LogrusLoggingSystem) Error

func (LogrusLoggingSystem) Trace

type TestingLoggingSystem added in v0.0.2

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

func NewTestingLoggingSystem added in v0.0.2

func NewTestingLoggingSystem(tb testing.TB) *TestingLoggingSystem

func (TestingLoggingSystem) Debug added in v0.0.2

func (TestingLoggingSystem) EnabledLevel added in v0.0.2

func (t TestingLoggingSystem) EnabledLevel() Level

func (TestingLoggingSystem) Error added in v0.0.2

func (TestingLoggingSystem) Trace added in v0.0.2

type ZerologLoggingSystem added in v0.0.2

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

func NewZerologLoggingSystem added in v0.0.2

func NewZerologLoggingSystem(logger zerolog.Logger) ZerologLoggingSystem

func (ZerologLoggingSystem) Debug added in v0.0.2

func (ZerologLoggingSystem) EnabledLevel added in v0.0.2

func (t ZerologLoggingSystem) EnabledLevel() Level

func (ZerologLoggingSystem) Error added in v0.0.2

func (ZerologLoggingSystem) Trace added in v0.0.2

Jump to

Keyboard shortcuts

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