Documentation
¶
Overview ¶
Package log provides utilities for structured logging in applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Color ¶ added in v0.2.1
type Color string
Color represents a terminal color escape code.
const ( Black Color = "\033[30m" // Black color Red Color = "\033[31m" // Red color Green Color = "\033[32m" // Green color Yellow Color = "\033[33m" // Yellow color Blue Color = "\033[34m" // Blue color Magenta Color = "\033[35m" // Magenta color Cyan Color = "\033[36m" // Cyan color White Color = "\033[37m" // White color Orange Color = "\033[38;5;208m" // Orange color (using extended color) )
Predefined terminal color escape codes.
type Logger ¶
type Logger interface {
Info(string, ...any)
Debug(string, ...any)
Warn(string, ...any)
Error(string, ...any)
}
Logger is an interface that defines methods for structured logging.
func NewColored ¶ added in v0.2.1
NewColored wraps an existing Logger and applies ANSI color to its messages.
func NewPrefixed ¶
NewPrefixed creates a new Logger that prefixes all log messages with the specified prefix.
func NewZerolog ¶
NewZerolog creates a new Logger with the specified log level and writer. Details: https://github.com/rs/zerolog
type Mock ¶
type Mock struct {
Messages []string
}
Mock is a Mock logger that collects log messages for testing purposes.
Click to show internal directories.
Click to hide internal directories.