logger

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute interface {
	Key() string
	Value() interface{}
}

Attribute is an interface that a property that can be written into a log message must have in order to do so.

type Extractor

type Extractor interface {
	Extract(ctx context.Context) []Attribute
}

Extractor is an interface that a plugin can implement to provide an API allowing the service extract content from its context to add them into log messages.

type Logger

type Logger interface {
	// Debug outputs messages using debug level.
	Debug(ctx context.Context, msg string, attrs ...Attribute)

	// Internal outputs messages using the internal level.
	Internal(ctx context.Context, msg string, attrs ...Attribute)

	// Info outputs messages using the info level.
	Info(ctx context.Context, msg string, attrs ...Attribute)

	// Warn outputs messages using warning level.
	Warn(ctx context.Context, msg string, attrs ...Attribute)

	// Error outputs messages using error level.
	Error(ctx context.Context, msg string, attrs ...Attribute)

	// Fatal outputs message using fatal level.
	Fatal(ctx context.Context, msg string, attrs ...Attribute)

	// SetLogLevel changes the current messages log level.
	SetLogLevel(level string) (string, error)

	// Level gets the current log level.
	Level() string
}

Logger is the log interface that is available for all services to show messages using different levels.

Jump to

Keyboard shortcuts

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