devel
devel copied to clipboard
improve engine logging
In the application there are console logging statements all around the code base like that:
from logs import lg
...
if _Debug:
lg.out(_DebugLevel, 'something is happening here')
This kind of logging mechanism is usually used for debugging of a single python module: _Debug
and _DebugLevel
variables are defined in every single python file. This helps during development and testing, but in production code _Debug
is always set to False
in all of the files - so no output is going to the console from those logging statements.
Also, application uses another kind of logging methods to print some "more important" information in the console during run-time: debug
, info
, warning
, error
and exception
logging statements can be also used:
from logs import lg
...
lg.warning('this is a warning message')
Both of those logging mechanisms are implemented in the logs.lg
module : https://github.com/bitdust-io/devel/blob/master/logs/lg.py
There is a global setting that defines "global debug level" which controls how much logging information will be printed in the console during run-time: https://github.com/bitdust-io/devel/blob/master/main/config_types.py#L79
By default debug logging level is 0 when you installed app for the first time. It is possible to quickly change the debug level in the app settings via console command:
bitdust set debug 20
The problem is that the global debug level setting only controls the first logging mechanism (which uses _Debug
and _DebugLevel
variables in every python module) but not the second logging mechanism which uses info
, warn
, err
, etc...
We can improve the app logging in a different ways.
For example we can make possible to turn on/off via program settings each logging statement individually:
bitdust set debug warning off
It would be also very useful to be able to turn on/off the _Debug
-based logging for every individual module during run-time, which is not possible at the moment. For example:
bitdust set debug p2p.p2p_service on
can I work on this? Please assign this to me.
Yes please, @mihir1739
Assigned, it is all yours. :+1: