log_verbosity¶
Log levels¶
The protoprimer uses python logging module to implement logs.
Therefore, its log levels have given names as str and values as int:
[stack traces are printed regardless of the log level]
<--- -qqq
FATAL = 50 = CRITICAL <--- -qq
ERROR = 40 <--- -q
WARN = 30 = WARNING <--- [default for `stderr` log]
INFO = 20 <--- -v [default for file log]
DEBUG = 10 <--- -vv
<--- -vvv
The CLI args can control verbosity for stderr output relative to default WARN level:
Each additional
-voption increases verbosity (decraase log level -10).Each additional
-qoption decreases verbosity (increase log level +10).
PROTOPRIMER_STDERR_LOG_LEVEL env var¶
The PROTOPRIMER_STDERR_LOG_LEVEL env var sets initial stderr log level (before CLI args are parsed).
Its values can be either the str given names or an int number.
If not set, the default is logging.WARN level.
Log output¶
There are two log output "channels":
stderr
file
The CLI args control stderr log level with logging.WARN as default.
The file log level is defaults to logging.INFO,
but it is adjusted to at least as verbose as stderr.
Other non-logging output on stderr¶
The same stderr log level can also control any additional output sent to stderr, for example:
Stacktrace printed on exception by
python.Any output made by
print("", file=file=sys.stderr).Output from the external commands (e.g.
pip,uv, ...) by propagating relevant (-qor-v) options....
Each case requires special protoprimer logic (obviously, not handled by logging itself).