hassle-free nicely-formatted console and file logging in Python
Project description
Fancy Logging
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.4.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for fancylogging-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7afa8c750e0418c63702d816ca53b0ffcbb0456fe7aa378075c08106f72f681 |
|
MD5 | 331e54c7a7754c09a4a1770052b45a51 |
|
BLAKE2b-256 | 76149c17b51ea770f1c40801173008c912398432eadf89a0efcbe9b34e5814ba |