PLogger: An Intelligent Logger for Preserving What Matters Most
PLogger is a universal Python logger designed for collecting and analyzing performance metrics, experimental results, or any other structured data. Its main feature is intelligent rotation strategies that allow you to preserve the most unique and interesting records (outliers) while removing redundant data.
Unlike standard loggers that simply delete old entries, PLogger analyzes the data and retains those that stand out most from the rest.
Key Features
- Intelligent Rotation: Built-in strategies (
by_metric,by_group_metric) to preserve the most significant data when the log limit is reached. - Thread-Safety: Secure logging from multiple threads without the risk of data corruption.
- Ease of Use: A concise API for quick integration into any project.
- CSV Logging: Data is stored in a universal and easily readable CSV format.
- Zero Configuration: Automatic creation of log directories and files.
Installation
pip install plogger
(Note: After you publish the package to PyPI)
Basic Usage
from pathlib import Path
from plogger import PLogger
# Initialize the logger
# Retain up to 100 entries, then remove the "least interesting" based on 'latency_ms' metric
logger = PLogger(
log_path=Path("performance_logs.csv"),
header=["request_id", "latency_ms", "status_code"],
max_entries=100,
rotation_strategy='by_metric',
metric_column='latency_ms'
)
# Log regular requests
logger.log({"request_id": "abc-123", "latency_ms": 52, "status_code": 200})
logger.log({"request_id": "def-456", "latency_ms": 55, "status_code": 200})
# ...after many entries...
# Log an unusually long request.
# Thanks to the 'by_metric' strategy, this record is highly likely
# to be preserved in the log even after rotation.
logger.log({"request_id": "xyz-789", "latency_ms": 5300, "status_code": 500})
Rotation Strategies
fifo: Standard "first-in, first-out" strategy. Removes the oldest entry.by_metric: Finds a pair of entries with the smallest difference in a numerical metric (metric_column) and removes the older one from that pair. Ideal for preserving outliers and unique values.by_group_metric: First finds the largest group of entries (bygroup_column), and then applies theby_metriclogic within that group. Useful when you need to analyze anomalies within the context of a specific category.
License
The project is distributed under the MIT License.
Metadata
Release files for chu4hel-plogger 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chu4hel_plogger-0.1.0.tar.gz | 5.9 kB | Without provenance | Details for chu4hel_plogger-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chu4hel_plogger-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for chu4hel_plogger-0.1.0-py3-none-any.whl |
Total release size: 12.9 kB
Release files / chu4hel_plogger-0.1.0.tar.gz
| Download URL | chu4hel_plogger-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62ea6aa1f69f9e0d4af7aee5cfb5f6d3bf4a5e926751cc43c64cdda6fefd5a6a
|
|
BLAKE2b-256 checksum How to use checksums |
5eefb3d3e5d961662ebca9d4dfca4cfd39415cb0dc86d00b60e259a38aab5e6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.5 Windows/11
|
Release files / chu4hel_plogger-0.1.0-py3-none-any.whl
| Download URL | chu4hel_plogger-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9dfb861bdb36339138424fb9e6a37571305c24d70acd1bec441cfa06b2406da
|
|
BLAKE2b-256 checksum How to use checksums |
fc24e6582dcb3467237ad3c591170d3e0776588491ff078dfbf6127a9996cddf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.5 Windows/11
|
Security for chu4hel-plogger 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.