Member-only story
In this article, I’d like to introduce Loguru (https://github.com/Delgan/loguru), a powerful logging tool that can significantly enhance your logging experience and is incredibly easy to use.
Let’s take a quick look at one example:
It is plug-and-play and has functions such as rolling logs in multiple ways, automatically compressing log files, and regularly deleting them. In addition, functions such as multi-thread safety, highlighting logs, and log alerts are not a problem.
How to Install
Install Loguru is super easy as well, just run the following command in your Python venv:
$ pip install loguru
and the installation is done.
Basic Usage
In Loguru, if you need to output debug logs to the terminal, you can do the following:
from loguru import logger
logger.debug("That's it, beautiful and simple logging!")
The output will look like:
If you need to output the log to a file, just do this:
from loguru import…