Documentation
¶
Index ¶
- Constants
- Variables
- type CLIColorPalette
- type LogHandler
- func (o *LogHandler) CheckConfiguration(logFileName string) error
- func (o *LogHandler) Enabled(_ context.Context, level slog.Level) bool
- func (o *LogHandler) Handle(_ context.Context, r slog.Record) error
- func (o *LogHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (o *LogHandler) WithGroup(name string) slog.Handler
- type LogLevel
Constants ¶
const DefaultTimeFormat = "YYYY-MM-DD HH:mm:ss"
DefaultTimeFormat defines the layout string used for timestamp rendering.
const DefaultTimeZone = "UTC"
DefaultTimeZone defines the default fallback timezone configuration.
Variables ¶
var DefaultCLIPalette = &CLIColorPalette{
Debug: ansiCyan,
Info: ansiGreen,
Warn: ansiYellow,
Error: ansiRed,
DateTime: ansiGray,
}
DefaultCLIPalette provides the standard out-of-the-box color definitions for readable command line outputs.
Functions ¶
This section is empty.
Types ¶
type CLIColorPalette ¶
type CLIColorPalette struct {
Debug string `json:"debug"`
Info string `json:"info"`
Warn string `json:"warn"`
Error string `json:"error"`
DateTime string `json:"datetime"`
}
CLIColorPalette manages the specific ANSI string colors associated with each logging level and metadata element inside CLI environments.
type LogHandler ¶
type LogHandler struct {
TimeFormat string `json:"timeFormat"`
TimeZone string `json:"timeZone"`
UseTimeFormat string `json:"useTimeFormat"`
UseTimeZone *time.Location `json:"useTimeZone"`
LogCLI bool `json:"logCLI"`
LogCLILevel LogLevel `json:"logCLILevel"`
LogCLIColors bool `json:"logCLIColors"`
LogCLIColorPallete *CLIColorPalette `json:"logCLIColorPallete"`
LogRegistry bool `json:"logRegistry"`
LogRegistryLevel LogLevel `json:"logRegistryLevel"`
LogRegistryDirPath string `json:"logRegistryFilePath"`
LogRegistryFileName string `json:"logRegistryFileName"`
LogRegistryFileMaxSize xunits.Bytes `json:"logRegistryFileMaxSize"`
LogRegistryFileMaxAge xunits.TimeDuration `json:"logRegistryFileMaxAge"`
// contains filtered or unexported fields
}
LogHandler intercepts standard slog records to apply custom multi-destination routing, formatting layouts, and ANSI colorization.
func (*LogHandler) CheckConfiguration ¶
func (o *LogHandler) CheckConfiguration(logFileName string) error
CheckConfiguration processes structural validation across all target runtime parameters.
func (*LogHandler) Enabled ¶
Enabled decides whether the framework allows processing logs under the specified context conditions.
func (*LogHandler) Handle ¶
Handle processes incoming record fields routing them into standard channels or output logs.
type LogLevel ¶
type LogLevel string
LogLevel represents the custom severity thresholds supported by this logger.
const ( // LevelAll enables all available logging severities. LevelAll LogLevel = "all" // LevelNone completely silences the logger output. LevelNone LogLevel = "none" // LevelInfo filters logs to only show information, warning, and error messages. LevelInfo LogLevel = "info" // LevelWarn filters logs to only show warning and error messages. LevelWarn LogLevel = "warn" // LevelError restricts logs to error messages only. LevelError LogLevel = "error" )