Skip to content

Improve logging & error output #137

@TheJolman

Description

@TheJolman

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 fmt and log for logging info and errors, and only sometimes sending errors to stderr with Fprintf.

How

  1. Decide on a strategy for both binaries (they don't have to use the same one) and document it
  2. Consistently apply pattern/strategy to codebase
  3. Make sure errors/warnings are being sent to stderr and regular output that use should always see is being sent to stdout
  4. Log level should be configurable

API

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:

These are just suggestions. You can deviate from them but have a reason for doing so.

CLI

Cobra comes with error functions that we should almost def be using: https://pkg.go.dev/github.com/spf13/cobra#CheckErr

Metadata

Metadata

Assignees

Labels

2 - BEGINNERAn issue where no prerequisite knowledge is requiredapiRelating to the API onlycliRelating to the CLI onlylow prioLow priority. Something that doesn't affect core functionality.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions