dosage
dosage copied to clipboard
Migrate home-grown output logging to standard Python logging
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.