Using the dysh logger#
dysh has a built-in logging mechanism, based on the
Python logging module,
whereby messages are categorized by log level (severity) and logged to
a file and/or the screen.
The command line arguments that control logging are
dysh
-v {0,1,2,3}, --verbosity {0,1,2,3} Set logging verbosity
--log LOG Specify log path
-q, --quiet Silence DEBUG- and INFO-level logs to stderr
The log verbosity level is set either on the command line with -v
or --verbosity or can be set in the Python session itself with init_logging.
You can think of verbosity as the complement of the traditional log severity level.
The values of verbosity and severity levels are as follows:
Verbosity |
Log Severity Level |
|---|---|
3 |
DEBUG |
2 |
INFO |
1 |
ERROR |
0 |
WARNING |
Setting the log verbosity level interactively while in dysh:
from dysh.log import init_logging
init_logging(1) # Log only ERROR or higher