hassle-free nicely-formatted console and file logging in Python
Project description
Introduction
This Python module provides an advanced logging setup using rich for console logging and python-json-logger for file logging. It allows for detailed and formatted logging, ideal for applications requiring high-level logging capabilities.
Installation
This module requires the following dependencies:
Usage
Import setup_fancy_logging from the module and configure your logging setup by specifying parameters like base_logger_name, console_log_level, file_log_level, log_file_path, and others.
Example:
import logging
from fancylogging import setup_fancy_logging
log = logging.getLogger("test")
if __name__ == "__main__":
setup_fancy_logging(
"test",
console_log_level=logging.INFO,
file_log_level=logging.DEBUG,
file_log_path="logs/test.json",
file_mode="w",
)
log.info("Info message")
log.debug("Debug message")
log.warning("Warning message")
log.error("Error message")
log.critical("Critical message")
try:
raise Exception("Raising a test exception")
except Exception:
log.exception("Exception message")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fancylogging-0.0.3.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for fancylogging-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e99813d17887635faecedd6a12b1f9cf12a03d52b30e11bff5a8c4a554dad53 |
|
MD5 | 779212effca1fcee143152adb03c6f26 |
|
BLAKE2b-256 | 78a1c55ec743c9889e0947071ba696bf046f215b07bb03ad83c0480aeb5cb38e |