Skip to main content

hassle-free nicely-formatted console and file logging in Python

Project description

PyPI - Version

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fancylogging-0.0.4-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file fancylogging-0.0.4.tar.gz.

File metadata

  • Download URL: fancylogging-0.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fancylogging-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d25387bd8f0b475a77a4f1781a717daf91704de57f730ad43da572e35d4892b0
MD5 19a377b1ed4147cdf509a454bc0f0978
BLAKE2b-256 2ad34b06cdace672c9b69d2d6766e3eecd4b009d9439ecbf4226efe37b09218b

See more details on using hashes here.

File details

Details for the file fancylogging-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: fancylogging-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fancylogging-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f7afa8c750e0418c63702d816ca53b0ffcbb0456fe7aa378075c08106f72f681
MD5 331e54c7a7754c09a4a1770052b45a51
BLAKE2b-256 76149c17b51ea770f1c40801173008c912398432eadf89a0efcbe9b34e5814ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page