-
Notifications
You must be signed in to change notification settings - Fork 10
Improve logging & error output #137
Copy link
Copy link
Open
Labels
2 - BEGINNERAn issue where no prerequisite knowledge is requiredAn issue where no prerequisite knowledge is requiredapiRelating to the API onlyRelating to the API onlycliRelating to the CLI onlyRelating to the CLI onlylow prioLow priority. Something that doesn't affect core functionality.Low priority. Something that doesn't affect core functionality.
Metadata
Metadata
Assignees
Labels
2 - BEGINNERAn issue where no prerequisite knowledge is requiredAn issue where no prerequisite knowledge is requiredapiRelating to the API onlyRelating to the API onlycliRelating to the CLI onlyRelating to the CLI onlylow prioLow priority. Something that doesn't affect core functionality.Low priority. Something that doesn't affect core functionality.
Why
Logging and error handling is currently kinda all over the place in both the API and CLI. We're using a mix of both
fmtandlogfor logging info and errors, and only sometimes sending errors tostderrwithFprintf.How
stderrand regular output that use should always see is being sent tostdoutAPI
We can continue using
log, but there are more powerful logging libraries that have easily configurable log levels (e.g., INFO, DEBUG, WARN, FATAL).Options:
log/slog: https://pkg.go.dev/log/slogcharmbracelet/log: https://github.com/charmbracelet/logCLI
Cobra comes with error functions that we should almost def be using: https://pkg.go.dev/github.com/spf13/cobra#CheckErr