loggers

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECS

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

ECS is a logger that will print logs in Elastic Common Schema ECS format.

func NewECS

func NewECS(options ...Option) ECS

NewECS creates a new ECS logger.

func (ECS) Error

func (ecs ECS) Error(ctx context.Context, msg string, info ...extensions.LogInfo)

Error logs a message at error level with context and additional info.

func (ECS) Info

func (ecs ECS) Info(ctx context.Context, msg string, info ...extensions.LogInfo)

Info logs a message at info level with context and additional info.

func (ECS) Warning added in v0.19.4

func (ecs ECS) Warning(ctx context.Context, msg string, info ...extensions.LogInfo)

Warning logs a message at warning level with context and additional info.

type Level added in v0.54.0

type Level int

Level is the minimum severity a logger will output. Messages with a severity below the configured level are discarded.

const (
	// LevelInfo outputs info, warning and error logs. This is the default.
	LevelInfo Level = iota
	// LevelWarning outputs warning and error logs only.
	LevelWarning
	// LevelError outputs error logs only.
	LevelError
)

type Option added in v0.54.0

type Option func(levelSetter)

Option is a functional option shared by the loggers of this package.

func WithLevel added in v0.54.0

func WithLevel(level Level) Option

WithLevel sets the minimum severity level that the logger will output. Messages below this level are silently discarded.

type Text added in v0.22.0

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

Text is a logger that will print logs in Elastic Common Schema format.

func NewText added in v0.22.0

func NewText(options ...Option) Text

NewText creates a new Human logger.

func (Text) Error added in v0.22.0

func (tl Text) Error(ctx context.Context, msg string, info ...extensions.LogInfo)

Error logs a message at error level with context and additional info.

func (Text) Info added in v0.22.0

func (tl Text) Info(ctx context.Context, msg string, info ...extensions.LogInfo)

Info logs a message at info level with context and additional info.

func (Text) Warning added in v0.22.0

func (tl Text) Warning(ctx context.Context, msg string, info ...extensions.LogInfo)

Warning logs a message at warning level with context and additional info.

Jump to

Keyboard shortcuts

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