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, andCRITICALlevels. - 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 theFusionLogFormatterconstructor.
Additionally, provide a custom datetime format string (usingdatetime.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
120eaca6b0674e9c0e8409756f117f5eb0f2b839fdc60f5629fe7a4e551b5bea
|
|
| MD5 |
1994e7fcbb0cf8fdd6ff460dfd6919e1
|
|
| BLAKE2b-256 |
c367d9098010cd2f87a4d7b55cb22bab4b57d2bdbb4d781c0123f708ca5641e4
|
Provenance
The following attestation bundles were made for fusion_logger_python-1.1.1.tar.gz:
Publisher:
python-publish.yml on FusionLogger/FusionLogger-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fusion_logger_python-1.1.1.tar.gz -
Subject digest:
120eaca6b0674e9c0e8409756f117f5eb0f2b839fdc60f5629fe7a4e551b5bea - Sigstore transparency entry: 179707285
- Sigstore integration time:
-
Permalink:
FusionLogger/FusionLogger-Python@8c2bf2f21c2bfab3f7cb12b4481ce543798bead1 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/FusionLogger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8c2bf2f21c2bfab3f7cb12b4481ce543798bead1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fusion_logger_python-1.1.1-py3-none-any.whl.
File metadata
- Download URL: fusion_logger_python-1.1.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17267bf61a2372c800fb6d844e2dcd48863ef2fadc27a47cb511ebfb87a8715e
|
|
| MD5 |
8718e3b9ecfd7ef05bd97fd6259c34c5
|
|
| BLAKE2b-256 |
2d32d59f3e0fcbb1e1a1042c7c7a3964803c718b31440cbd88e8d1feab1f664b
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fusion_logger_python-1.1.1-py3-none-any.whl -
Subject digest:
17267bf61a2372c800fb6d844e2dcd48863ef2fadc27a47cb511ebfb87a8715e - Sigstore transparency entry: 179707290
- Sigstore integration time:
-
Permalink:
FusionLogger/FusionLogger-Python@8c2bf2f21c2bfab3f7cb12b4481ce543798bead1 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/FusionLogger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8c2bf2f21c2bfab3f7cb12b4481ce543798bead1 -
Trigger Event:
release
-
Statement type: