Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve engine logging #706

Open
vesellov opened this issue Oct 9, 2022 · 2 comments
Open

improve engine logging #706

vesellov opened this issue Oct 9, 2022 · 2 comments

Comments

@vesellov
Copy link
Contributor

vesellov commented Oct 9, 2022

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
@mihir1739
Copy link

can I work on this? Please assign this to me.

@vesellov
Copy link
Contributor Author

Yes please, @mihir1739

Assigned, it is all yours. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants