logging

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterLevel

func FilterLevel(level slog.Level) func(slog.Handler) slog.Handler

FilterLevel wraps an existing slog.Handler but logs at a different level. This function can be used to create child loggers which should print only log levels at a different log level than the parent logger.

func NewLogger

func NewLogger(cfg *Config, metricsNamespace string) *slog.Logger

NewLogger creates a preconfigured slog logger with Prometheus metrics hook

Types

type Config

type Config struct {
	LogLevelInput string `yaml:"level"`
	LogLevel      slog.Level
}

Config for an slog logger

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config the server

func (*Config) Set

func (cfg *Config) Set(logLevel string) error

Set updates the value of the allowed log level by implementing the flag.Value interface

func (*Config) SetDefaults added in v0.4.0

func (c *Config) SetDefaults()

func (*Config) String

func (cfg *Config) String() string

String implements the flag.Value interface

Jump to

Keyboard shortcuts

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