lib.App: Make default log values overridable
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m0s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m11s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m40s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m59s
CI / Packaging test (push) Successful in 0s

The __init__() method reads default log configuration directly
from environment variables, making it impossible for subclasses to
change defaults.

Extract the defaults into _default_log_flags(), _default_log_level(),
_default_log_file(), and _default_show_backtrace() methods, then call
them from __init__(). Subclasses can now override these methods to
customize defaults without needing to override the entire __init__()
method.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-08-09 03:42:28 +02:00
commit 2eeaaf9681
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 44 additions and 15 deletions

View file

@ -11,7 +11,7 @@ jw-pkg swiss army knife
options:
--log-flags LOG_FLAGS
Log flags (default: stderr,position,prio,color)
Log flags (default: color,position,prio,stderr)
--log-level LOG_LEVEL
Log level (default: 5)
--log-file LOG_FILE Log file (default: None)