Skip to content

Logging #176

@gjermundgaraba

Description

@gjermundgaraba

I find myself wanting a logging system (to file) to more easily be able to debug.

I can implement this, but I want to check a couple of things first:

  1. Is that something you want in cliamp?
  2. If yes, do you have any strong preferences on libraries and ux?

My suggestion is something like this:
Setup:

  • library: log/slog
  • format: plain text
  • config: log_level = "info"
  • CLI override: --log-level debug|info|warn|error
  • file output: ~/.config/cliamp/cliamp.log

Behavior/DX:

  • Keep stdout/stderr for non-TUI commands and fatal startup errors
  • Refactor applog into a app-wide logger as a thin facade over slog with "intent-based" logging (you don't specify sinks, you specify intent), something like (first draft):
    • applog.(Debug(f)|Info(f)|Warn(f)|Error(f)) = diagnostic log
    • applog.Status(f) = footer
    • applog.(UserWarn(f)|UserError(f)) = diagnostic log + footer
  • Possible addition: set this up for plugins to utilize as well somehow (haven't given this part so much thought yet)

Let me know what you think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions