Skip to main content

Fusion Logger is a centralized logging framework that provides configurable log levels and dynamic scopes for fine-grained control over application logging. It features structured log records, flexible template-based formatting via tokens, and a fluent builder for easy logger configuration.

Project description

FusionLogger-Python

FusionLogger-Python is a centralized logging framework that provides configurable log levels and dynamic scopes for fine-grained control over application logging. It features structured log records, flexible template-based formatting via tokens, and a fluent builder for easy logger configuration.

Features

  • Configurable Log Levels: Supports DEBUG, INFO, WARNING, and CRITICAL levels.
  • Dynamic Scopes: Easily set and clear logging scopes for contextual logging.
  • Flexible Formatting: Customizable output format via token-based formatting; define log formats and datetime formats through string parameters in the formatter constructor.
  • Dual Logging Outputs: Supports both console and file logging (file mode: append).
  • High Performance: Capable of processing approximately 3000 log messages per second.

Requirements

  • Python Versions:
    • Developed under Python 3.12
    • Linted with PyLint under Python 3.8, 3.9, and 3.10
  • External Dependencies: None

Installation

Install FusionLogger-Python via pip:

pip install fusion-logger-python

Usage

A simple usage example can be found in the provided TestBenchmark.py file. Here is a brief example of how to initialize and use the logger:

from fusion_logger_python import FusionLoggerBuilder, FusionLogLevel

# Build and configure the logger
logger = FusionLoggerBuilder()
.set_name("MyAppLogger")
.set_min_level(FusionLogLevel.DEBUG)
.write_to_file("app.log")
.build()

# Log messages at different levels
logger.debug("This is a debug message.")
logger.info("This is an info message.")
logger.warning("This is a warning message.")
logger.critical("This is a critical error message.")

Configuration

  • Logging Levels:
    Set the minimum output level (e.g., DEBUG, INFO, WARNING, CRITICAL) using the fluent builder.

  • Output Formats:
    Specify custom log output formats by passing a format string to the FusionLogFormatter constructor.
    Additionally, provide a custom datetime format string (using datetime.strftime() formatting) if desired.

  • File Logging:
    The logger writes log entries to files in append mode. Simply add file paths via the builder methods.

Provided Components

  • FusionLogger: Core logging class handling log message creation and processing.
  • FusionLoggerBuilder: Fluent builder for easy and chainable logger configuration.
  • FusionLogProcessor: Singleton-based processor for handling log records (work in progress for thread safety).
  • FusionLogFormatter: Component to format log records based on templates.
  • FusionLogRecord: Structured container for all log entry metadata.
  • FusionLogLevel: Enum defining available log severity levels.

Performance & Best Practices

For best performance, initialize the logger during application startup. The token-based formatting approach is optimized for high throughput, achieving roughly 3000 messages per second. Note that while the processor's singleton implementation is designed for thread-safe operations, full thread safety is still a work in progress.

Known Issues

  • There are currently no known bugs.

License

This project is licensed under the MIT License.

Additional Information

For further details, please refer to the pyproject.toml file which contains project metadata and hosting information (e.g., GitHub repository details).

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

fusion_logger_python-1.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

fusion_logger_python-1.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file fusion_logger_python-1.1.1.tar.gz.

File metadata

  • Download URL: fusion_logger_python-1.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fusion_logger_python-1.1.1.tar.gz
Algorithm Hash digest
SHA256 120eaca6b0674e9c0e8409756f117f5eb0f2b839fdc60f5629fe7a4e551b5bea
MD5 1994e7fcbb0cf8fdd6ff460dfd6919e1
BLAKE2b-256 c367d9098010cd2f87a4d7b55cb22bab4b57d2bdbb4d781c0123f708ca5641e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fusion_logger_python-1.1.1.tar.gz:

Publisher: python-publish.yml on FusionLogger/FusionLogger-Python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fusion_logger_python-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fusion_logger_python-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17267bf61a2372c800fb6d844e2dcd48863ef2fadc27a47cb511ebfb87a8715e
MD5 8718e3b9ecfd7ef05bd97fd6259c34c5
BLAKE2b-256 2d32d59f3e0fcbb1e1a1042c7c7a3964803c718b31440cbd88e8d1feab1f664b

See more details on using hashes here.

Provenance

The following attestation bundles were made for fusion_logger_python-1.1.1-py3-none-any.whl:

Publisher: python-publish.yml on FusionLogger/FusionLogger-Python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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