Skip to main content

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

pip install BitSig

Quick Start

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.


License

This project is licensed under the Apache License, Version 2.0. Copyright 2025 Tristan McBride Sr.


Acknowledgements

Project by:

  • Tristan McBride Sr.
  • Sybil

Release files for BitSig 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BitSig 0.1.5
File Size Uploaded
bitsig-0.1.5.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BitSig 0.1.5
File Interpreter ABI Platform
bitsig-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / bitsig-0.1.5.tar.gz

Download URL bitsig-0.1.5.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
636f17e219e8a8a055b5886b23c43f1cb37b240c71f6dbba732bfbdc46ad446f
BLAKE2b-256 checksum
How to use checksums
637460232cb0a110b2c77da23cbd4212a1927073c12f71b39b62bde4f915f29d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / bitsig-0.1.5-py3-none-any.whl

Download URL bitsig-0.1.5-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb0f3bfd672067591d6ba3f3034d9b4c9f9cedfbecee08b5a75dfc4fd6e40f3d
BLAKE2b-256 checksum
How to use checksums
b393e04f2c17d99d21ab9e242120565e7e2763c4da39ab3a66621803d41a4c56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page