How to use in multiple modules?
For example I have this project which contains log.py main.py core.py and I want to configure my logger in log.py and use it in main and core modules, what is the best practice? Any examples?
You just have to do from loguru import logger in all of your modules.
I suggest the logger to be configured by the entry point of your application, which I assume is main.py.
You just have to do
from loguru import loggerin all of your modules.I suggest the
loggerto be configured by the entry point of your application, which I assume ismain.py.
This should have been included as part of official documentation. Wasted my time by many hours to search answer for this same question until I found this issue.
Strongly recommended for inclusion in official documentation.
I think the official documentation should give some best practices in the project
Hi @wxguy and @rainzee.
There exists actually an entry in the documentation that gives an overview of the recommended structure: Configuring Loguru to be used by a library or an application.
Feel free to suggest improvements and clarifications.