Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate home-grown output logging to standard Python logging #309

Open
6 tasks
TobiX opened this issue Mar 19, 2024 · 0 comments
Open
6 tasks

Migrate home-grown output logging to standard Python logging #309

TobiX opened this issue Mar 19, 2024 · 0 comments
Labels
chore Maintenance, build scripts, etc.

Comments

@TobiX
Copy link
Member

TobiX commented Mar 19, 2024

This includes multiple steps:

  • Figure out "correct" mapping from old "levels" to Python logging levels
  • Replace all calls to out.(warn|debug|info|error) with standard Python logging calls
  • Find a replacement for out.pager()
  • Find a good replacement for tracking the current "context"
  • Replace init code (cmd.py) with standard logging configuration
  • Fine-tune output format & colors (maybe use rich?

Mapping from current "levels" (see https://github.com/webcomics/dosage/blob/master/dosagelib/output.py#L29) to Python standard levels:

out. method level Prefix Color Python level
error 0 ERROR: RED logging.ERROR
warn 0 WARN: YELLOW logging.WARNING
info 0 none normal logging.INFO
info² 1 (define extra level 15 maybe?)
debug 2 none WHITE logging.DEBUG
debug² 3 (define extra level 5 maybe?)

² Called with different level then default...

out.exception writes one line using error (Level 0) and the backtrace with Level 1. Since the default for dosage is 0, normal runs only get the error message, adding -v raises the level to 1, which allows you to see the backtrace.

Is this a mess? Yes, this is a mess.

@TobiX TobiX added chore Maintenance, build scripts, etc. and removed enhancement labels May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Maintenance, build scripts, etc.
Projects
None yet
Development

No branches or pull requests

1 participant