Let's say I'm setting up a script or library that has a few dependencies which use Python's standard library logging module but I want to use loguru to capture all logs. My first naive attempt was a complete failure, but I'm not sure how to proceed.
To test I have two files
main.py:
from loguru import logger
from base_log import test_func
if __name__ == "__main__":
logger.debug("In main")
test_func()
and base_log.py:
import logging
logger = logging.getLogger(__name__)
def test_func():
logger.warning("In test_func")
If I run main.py (i.e. python main.py) then I get the following output:
2020-12-16 10:57:48.269 | DEBUG | __main__:<module>:6 - In main
In test_func
When I expect:
2020-12-16 11:01:34.408 | DEBUG | __main__:<module>:6 - In main
2020-12-16 11:01:34.408 | WARNING | base_log:test_func:9 - In test_func