logger

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 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 returns the attribute's name.
	Key() string

	// Value returns the attribute's value.
	Value() interface{}
}

Attribute represents a key-value pair attached to log messages.

Attributes provide additional context to log entries and are used to structure logs for better querying and filtering.

type LoggerAPI

type LoggerAPI interface {
	// Debug logs a message at the debug level with optional attributes.
	Debug(ctx context.Context, msg string, attrs ...Attribute)

	// Internal logs a message at the internal level with optional attributes.
	Internal(ctx context.Context, msg string, attrs ...Attribute)

	// Info logs a message at the info level with optional attributes.
	Info(ctx context.Context, msg string, attrs ...Attribute)

	// Warn logs a message at the warning level with optional attributes.
	Warn(ctx context.Context, msg string, attrs ...Attribute)

	// Error logs a message at the error level with optional attributes.
	Error(ctx context.Context, msg string, attrs ...Attribute)

	// Fatal logs a message at the fatal level with optional attributes.
	// It causes the process to terminate.
	Fatal(ctx context.Context, msg string, attrs ...Attribute)

	// SetLogLevel changes the current log level to the specified value.
	// Returns the previous level or an error if the input is invalid.
	SetLogLevel(level string) (string, error)

	// Level returns the current log level as a string.
	Level() string
}

LoggerAPI provides a structured logging interface with multiple log levels.

This interface is implemented by the mikros framework and is available to all services by default. It allows emitting log messages with contextual metadata using attributes, and supports runtime log level configuration.

Jump to

Keyboard shortcuts

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