---
## Features
* **Deduplicated Logging:** Prevents duplicate log entries within each log file, keeping your logs concise and clean.
* **Per-Level Log Files:** Saves log entries to separate files by level (`Debug.txt`, `Info.txt`, `Warning.txt`, `Error.txt`, `Critical.txt`) for easy tracking and analysis.
* **Automatic Log Cleanup:** Periodically purges log entries older than your retention window (default: 24 hours), with full customization.
* **Thread-Safe:** All logging and cleanup operations are safe for multi-threaded environments.
* **Console Output:** Only errors and critical logs are printed to the console by default, with consistent formatting.
* **Flexible Integration:** Just call `configureBitSig(logsDir)` and start logging—no need to rewrite your codebase.
---
## Installation
```bash
pip install BitSig
```
---
## Quick Start
```python
from BitSig import configureBitSig
from pathlib import Path
import logging
# Initialize BitSig (set your desired logs directory)
logsDir = Path("logs")
configureBitSig(logsDir)
logger = logging.getLogger(__name__)
# Use standard logging
def loggingErrorTest():
try:
# Simulate an error for testing
raise ValueError("This is a test error for logging.")
except Exception as e:
logger.error(f"An error occurred", exc_info=True)
```
---
## How It Works
* **Deduplication:**
BitSig compares each new log entry (except the timestamp/level prefix) to recent entries in its level’s file and writes only unique messages.
* **Cleanup:**
Log files are automatically cleaned in the background, keeping only entries within your retention window (default: 24 hours, configurable with `LOG_RETENTION_HOURS` in your `.env` or environment).
* **Retention:**
Customize how long logs are kept by setting the `LOG_RETENTION_HOURS` environment variable.
---
## Configuration
* **Log Directory:**
Pass any `Path` to `configureBitSig()`. Directory will be created if missing.
* **Log Retention:**
Set the number of hours to keep log entries:
```
LOG_RETENTION_HOURS=48
```
(in your `.env` or system environment)
* **Threaded Cleanup:**
BitSig launches a daemon thread to clean logs every hour. No user intervention needed.
---
## Advanced Usage
* **Multiple Loggers:**
All loggers in your app will use the same log directory and handlers by default.
---
## Notes
* BitSig is compatible with Python 3.8+ and all standard `logging` calls.
* Log file deduplication works at the message-body level for maximum efficiency.
* BitSig is optimized for long-running, high-traffic, or mission-critical systems.
---
## Code Examples
You can find code examples on my [GitHub repository](https://github.com/TristanMcBrideSr/TechBook).
---
## License
This project is licensed under the [Apache License, Version 2.0](LICENSE).
Copyright 2025 Tristan McBride Sr.
---
## Acknowledgements
Project by:
- Tristan McBride Sr.
- Sybil
Raw data
{
"_id": null,
"home_page": null,
"name": "BitSig",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "\"Tristan McBride Sr.\" <142635792+TristanMcBrideSr@users.noreply.github.com>",
"keywords": "Logging, Error Handling, System Monitoring, Python, loggers, error logging, system errors",
"author": "Tristan McBride Sr.",
"author_email": "\"Tristan McBride Sr.\" <142635792+TristanMcBrideSr@users.noreply.github.com>",
"download_url": "https://files.pythonhosted.org/packages/63/74/60232cb0a110b2c77da23cbd4212a1927073c12f71b39b62bde4f915f29d/bitsig-0.1.5.tar.gz",
"platform": null,
"description": "\ufeff\r\n---\r\n\r\n## Features\r\n\r\n* **Deduplicated Logging:** Prevents duplicate log entries within each log file, keeping your logs concise and clean.\r\n* **Per-Level Log Files:** Saves log entries to separate files by level (`Debug.txt`, `Info.txt`, `Warning.txt`, `Error.txt`, `Critical.txt`) for easy tracking and analysis.\r\n* **Automatic Log Cleanup:** Periodically purges log entries older than your retention window (default: 24 hours), with full customization.\r\n* **Thread-Safe:** All logging and cleanup operations are safe for multi-threaded environments.\r\n* **Console Output:** Only errors and critical logs are printed to the console by default, with consistent formatting.\r\n* **Flexible Integration:** Just call `configureBitSig(logsDir)` and start logging\u2014no need to rewrite your codebase.\r\n\r\n---\r\n\r\n## Installation\r\n\r\n```bash\r\npip install BitSig\r\n```\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n```python\r\nfrom BitSig import configureBitSig\r\nfrom pathlib import Path\r\nimport logging\r\n\r\n# Initialize BitSig (set your desired logs directory)\r\nlogsDir = Path(\"logs\")\r\nconfigureBitSig(logsDir)\r\n\r\nlogger = logging.getLogger(__name__)\r\n\r\n# Use standard logging\r\ndef loggingErrorTest():\r\n try:\r\n # Simulate an error for testing\r\n raise ValueError(\"This is a test error for logging.\")\r\n except Exception as e:\r\n logger.error(f\"An error occurred\", exc_info=True)\r\n```\r\n\r\n---\r\n\r\n## How It Works\r\n\r\n* **Deduplication:**\r\n BitSig compares each new log entry (except the timestamp/level prefix) to recent entries in its level\u2019s file and writes only unique messages.\r\n* **Cleanup:**\r\n Log files are automatically cleaned in the background, keeping only entries within your retention window (default: 24 hours, configurable with `LOG_RETENTION_HOURS` in your `.env` or environment).\r\n* **Retention:**\r\n Customize how long logs are kept by setting the `LOG_RETENTION_HOURS` environment variable.\r\n\r\n---\r\n\r\n## Configuration\r\n\r\n* **Log Directory:**\r\n Pass any `Path` to `configureBitSig()`. Directory will be created if missing.\r\n\r\n* **Log Retention:**\r\n Set the number of hours to keep log entries:\r\n\r\n ```\r\n LOG_RETENTION_HOURS=48\r\n ```\r\n\r\n (in your `.env` or system environment)\r\n\r\n* **Threaded Cleanup:**\r\n BitSig launches a daemon thread to clean logs every hour. No user intervention needed.\r\n\r\n---\r\n\r\n## Advanced Usage\r\n\r\n* **Multiple Loggers:**\r\n All loggers in your app will use the same log directory and handlers by default.\r\n\r\n---\r\n\r\n## Notes\r\n\r\n* BitSig is compatible with Python 3.8+ and all standard `logging` calls.\r\n* Log file deduplication works at the message-body level for maximum efficiency.\r\n* BitSig is optimized for long-running, high-traffic, or mission-critical systems.\r\n\r\n---\r\n\r\n## Code Examples\r\n\r\nYou can find code examples on my [GitHub repository](https://github.com/TristanMcBrideSr/TechBook).\r\n\r\n---\r\n\r\n## License\r\n\r\nThis project is licensed under the [Apache License, Version 2.0](LICENSE).\r\nCopyright 2025 Tristan McBride Sr.\r\n\r\n---\r\n\r\n## Acknowledgements\r\n\r\nProject by:\r\n- Tristan McBride Sr.\r\n- Sybil\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A modern way to auto log system errors",
"version": "0.1.5",
"project_urls": {
"Homepage": "https://github.com/TristanMcBrideSr"
},
"split_keywords": [
"logging",
" error handling",
" system monitoring",
" python",
" loggers",
" error logging",
" system errors"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b393e04f2c17d99d21ab9e242120565e7e2763c4da39ab3a66621803d41a4c56",
"md5": "b755a10c9c0dad30fbdf226447d4950d",
"sha256": "bb0f3bfd672067591d6ba3f3034d9b4c9f9cedfbecee08b5a75dfc4fd6e40f3d"
},
"downloads": -1,
"filename": "bitsig-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b755a10c9c0dad30fbdf226447d4950d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 4916,
"upload_time": "2025-07-17T22:19:12",
"upload_time_iso_8601": "2025-07-17T22:19:12.048734Z",
"url": "https://files.pythonhosted.org/packages/b3/93/e04f2c17d99d21ab9e242120565e7e2763c4da39ab3a66621803d41a4c56/bitsig-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "637460232cb0a110b2c77da23cbd4212a1927073c12f71b39b62bde4f915f29d",
"md5": "17dcdb4223ec56f797bd3aa343bc4bd2",
"sha256": "636f17e219e8a8a055b5886b23c43f1cb37b240c71f6dbba732bfbdc46ad446f"
},
"downloads": -1,
"filename": "bitsig-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "17dcdb4223ec56f797bd3aa343bc4bd2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4978,
"upload_time": "2025-07-17T22:19:13",
"upload_time_iso_8601": "2025-07-17T22:19:13.191703Z",
"url": "https://files.pythonhosted.org/packages/63/74/60232cb0a110b2c77da23cbd4212a1927073c12f71b39b62bde4f915f29d/bitsig-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-17 22:19:13",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "bitsig"
}