log

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int8

A Level is a logging priority. Higher levels are more important.

const (
	// LevelDebug logs are typically voluminous, and are usually disabled in
	// production.
	LevelDebug Level = iota + 1
	// LevelInfo is the default logging priority.
	LevelInfo
	// LevelWarn logs are more important than Info, but don't need individual
	// human review.
	LevelWarn
	// LevelError logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	LevelError
	// LevelPanic logs a message, then panics.
	LevelPanic
)

type Logger

type Logger interface {
	// Named creates a child logger with the given namespace.
	Named(name string) Logger
	// WithCallerSkip adjusts the number of stack frames to skip when reporting caller location.
	WithCallerSkip(skip int) Logger
	// Enabled checks whether the given log level is enabled.
	Enabled(level Level) bool
	// Sync flushes any buffered log entries.
	Sync()
	// Debug logs a message at Debug level.
	Debug(message string)
	// Debugf logs a formatted message at Debug level.
	Debugf(template string, args ...any)
	// Info logs a message at Info level.
	Info(message string)
	// Infof logs a formatted message at Info level.
	Infof(template string, args ...any)
	// Warn logs a message at Warn level.
	Warn(message string)
	// Warnf logs a formatted message at Warn level.
	Warnf(template string, args ...any)
	// Error logs a message at Error level.
	Error(message string)
	// Errorf logs a formatted message at Error level.
	Errorf(template string, args ...any)
	// Panic logs a message at Panic level and then panics.
	Panic(message string)
	// Panicf logs a formatted message at Panic level and then panics.
	Panicf(template string, args ...any)
}

Logger defines the core logging interface for structured logging across the framework.

type LoggerConfigurable added in v0.4.4

type LoggerConfigurable[T any] interface {
	// WithLogger sets the logger for the component and returns the configured instance.
	WithLogger(logger Logger) T
}

LoggerConfigurable defines an interface for components that can be configured with a logger.

Jump to

Keyboard shortcuts

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