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.0.0.tar.gz (13.2 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.0.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fusion_logger_python-1.0.0.tar.gz
  • Upload date:
  • Size: 13.2 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.0.0.tar.gz
Algorithm Hash digest
SHA256 ffb091cc676e5106dd97d0d127bacfbd1f2772250373dc4908d11a04a83c95c8
MD5 c5b6f5755c1bc5f396a6ba31e0722f74
BLAKE2b-256 88f6a3ad8d19d1580ef133eb12e9f0543217ebd50e5e70518b4cbf942af3c1b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for fusion_logger_python-1.0.0.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.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fusion_logger_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 983495a1bae280197b71c10fb296bd2ada0f27f246582247f8829721c3edbde9
MD5 f508cc42e993c1b34793de5d50986070
BLAKE2b-256 5e603324acdb69325bce60acd1c16d701122d8bad78128ec8dc2e9bb1454dbd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fusion_logger_python-1.0.0-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