Skip to content

Commit e1dc888

Browse files
committed
(Add:) Preparations for pip launch
1 parent a7a578a commit e1dc888

File tree

3 files changed

+122
-2
lines changed

3 files changed

+122
-2
lines changed

README.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,84 @@
11
# FusionLogger-Python
2-
FusionLogger-Python
2+
3+
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.
4+
5+
## Features
6+
7+
- **Configurable Log Levels:** Supports `DEBUG`, `INFO`, `WARNING`, and `CRITICAL` levels.
8+
- **Dynamic Scopes:** Easily set and clear logging scopes for contextual logging.
9+
- **Flexible Formatting:** Customizable output format via token-based formatting; define log formats and datetime formats through string parameters in the formatter constructor.
10+
- **Dual Logging Outputs:** Supports both console and file logging (file mode: append).
11+
- **High Performance:** Capable of processing approximately 3000 log messages per second.
12+
13+
## Requirements
14+
15+
- **Python Versions:**
16+
- Developed under Python 3.12
17+
- Linted with PyLint under Python 3.8, 3.9, and 3.10
18+
- **External Dependencies:** None
19+
20+
## Installation
21+
22+
Install FusionLogger-Python via pip:
23+
24+
```bash
25+
pip install fusion_logger_lasse27
26+
```
27+
28+
## Usage
29+
30+
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:
31+
32+
```python
33+
from fusion_logger import FusionLoggerBuilder, FusionLogLevel
34+
35+
# Build and configure the logger
36+
logger = FusionLoggerBuilder() \
37+
.set_name("MyAppLogger") \
38+
.set_min_level(FusionLogLevel.DEBUG) \
39+
.write_to_file("app.log") \
40+
.build()
41+
42+
# Log messages at different levels
43+
logger.debug("This is a debug message.")
44+
logger.info("This is an info message.")
45+
logger.warning("This is a warning message.")
46+
logger.critical("This is a critical error message.")
47+
```
48+
49+
## Configuration
50+
51+
- **Logging Levels:**
52+
Set the minimum output level (e.g., DEBUG, INFO, WARNING, CRITICAL) using the fluent builder.
53+
54+
- **Output Formats:**
55+
Specify custom log output formats by passing a format string to the `FusionLogFormatter` constructor.
56+
Additionally, provide a custom datetime format string (using `datetime.strftime()` formatting) if desired.
57+
58+
- **File Logging:**
59+
The logger writes log entries to files in append mode. Simply add file paths via the builder methods.
60+
61+
## Provided Components
62+
63+
- **FusionLogger:** Core logging class handling log message creation and processing.
64+
- **FusionLoggerBuilder:** Fluent builder for easy and chainable logger configuration.
65+
- **FusionLogProcessor:** Singleton-based processor for handling log records (work in progress for thread safety).
66+
- **FusionLogFormatter:** Component to format log records based on templates.
67+
- **FusionLogRecord:** Structured container for all log entry metadata.
68+
- **FusionLogLevel:** Enum defining available log severity levels.
69+
70+
## Performance & Best Practices
71+
72+
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.
73+
74+
## Known Issues
75+
76+
- There are currently no known bugs.
77+
78+
## License
79+
80+
This project is licensed under the [MIT License](LICENSE).
81+
82+
## Additional Information
83+
84+
For further details, please refer to the `pyproject.toml` file which contains project metadata and hosting information (e.g., GitHub repository details).

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "fusion_logger_lasse27"
7+
version = "1.0.0"
8+
authors = [
9+
{ name = "Lasse-Leander Hillen", email = "lassehillen@gmx.de" },
10+
]
11+
maintainers = [
12+
{ name = "Lasse-Leander Hillen", email = "lassehillen@gmx.de" },
13+
]
14+
description = """
15+
Fusion Logger is a centralized logging framework that provides configurable log
16+
levels and dynamic scopes for fine-grained control over application logging. It
17+
features structured log records, flexible template-based formatting via tokens,
18+
and a fluent builder for easy logger configuration.
19+
"""
20+
readme = "README.md"
21+
requires-python = ">=3.8"
22+
classifiers = [
23+
"Programming Language :: Python :: 3",
24+
"Operating System :: OS Independent",
25+
"Development Status :: 4 - Beta",
26+
"Intended Audience :: Developers",
27+
]
28+
license = "MIT"
29+
license-files = ["LICEN[CS]E*"]
30+
keywords = ["logging", "formatting"]
31+
32+
[project.urls]
33+
Homepage = "https://github.com/FusionLogger/FusionLogger-Python"
34+
Documentation = "https://github.com/FusionLogger/FusionLogger-Python/wiki"
35+
Repository = "https://github.com/FusionLogger/FusionLogger-Python"
36+
Issues = "https://github.com/FusionLogger/FusionLogger-Python/issues"
37+
Changelog = "https://github.com/FusionLogger/FusionLogger-Python/releases"

src/fusion_logger/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from .core import FusionLogger, FusionLoggerBuilder
22
from .defs import FusionLogLevel, FusionLogRecord
3-
from .processors import FusionLogFormatter
3+
from .processors import FusionLogFormatter, FusionLogProcessor
44

55
__all__ = [
66
'FusionLogger',
77
'FusionLogRecord',
88
'FusionLogLevel',
99
'FusionLogFormatter',
1010
'FusionLoggerBuilder',
11+
'FusionLogProcessor',
1112
]

0 commit comments

Comments
 (0)