This introduces using slog as a structured logger for the project. Created a LevelHandler struct that is responsible for only logging out messages below a configured log level.
Extended the config object to have a Log configuration to set
Level
Output
Type
Added the following command flags:
log.level (debug, info, warn, error)
log.output (stdout, stderr)
log.type (json, text)
Updated the csp and collector entrypoints to have accept a *slog.Logger parameter.
Started updating existing log.Printf statements to use appropriate logging.
TODO:
[ ] Update all collectors to accept a logger parameter
[ ] Determine best way to pass logger to helper methods that current log out via log.Printf
This introduces using slog as a structured logger for the project. Created a
LevelHandler
struct that is responsible for only logging out messages below a configured log level. Extended the config object to have a Log configuration to setAdded the following command flags:
log.level
(debug, info, warn, error)log.output
(stdout, stderr)log.type
(json, text)Updated the csp and collector entrypoints to have accept a
*slog.Logger
parameter. Started updating existing log.Printf statements to use appropriate logging.TODO:
[ ] Update all collectors to accept a logger parameter
[ ] Determine best way to pass logger to helper methods that current log out via
log.Printf
relates #32