Documentation
¶
Overview ¶
Package logger configures native slog with recursive structured-field redaction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
JSON bool
Level slog.Level
Output io.Writer
OwnOutput bool
File string
MaxSizeMB, MaxBackups, MaxAgeDays int
Compress bool
Service, Version, Environment, TimeFormat string
SanitizeText func(string) string
}
Config contains explicit constructor settings; see package documentation for defaults.
type Logger ¶
Logger embeds native slog and owns applicable configured outputs.
func New ¶
New constructs and validates an explicitly owned instance. See package documentation for defaults and cleanup.
func Open ¶
Open validates output settings and eagerly checks file access. New remains available for callers that deliberately use slog's lazy write error handling.
func (*Logger) Close ¶
Close releases owned resources. See package documentation for shutdown ordering.
func (*Logger) Flush ¶
Flush invokes a configured writer's flush contract. Injected writers remain caller-owned unless OwnOutput is explicitly enabled. Call after producers stop.
func (*Logger) WithContext ¶
WithContext copies logger correlation attributes from the supplied context.