Skip to main content

A modern way to auto log system errors

Project description


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 logmanager import configureBitSig
from pathlib import Path
import logging

# Initialize BitSig (set your desired logs directory)
logsDir = Path("logs")
configureBitSig(logsDir)

# Use standard logging
logger = logging.getLogger(__name__)
logger.info("This is an info message.")
logger.error("This is an error message.")

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

  • Custom Filters: BitSig supports adding more custom logging.Filter instances if needed.
  • Multiple Loggers: All loggers in your app will use the same log directory and handlers by default.

Example

from logmanager import configureBitSig
import logging

configureBitSig("my_logs")

logger = logging.getLogger("MyApp")
logger.info("Started application.")
logger.error("An error occurred.")

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.

License

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


Acknowledgements

Project by:

  • Tristan McBride Sr.
  • Sybil

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitsig-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bitsig-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file bitsig-0.1.0.tar.gz.

File metadata

  • Download URL: bitsig-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for bitsig-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48ffae1ffcf2ea12f283bace5d4772f1a1bdf286b5c0014108512f2e869bb4d5
MD5 8488d850d562ded5a5e26fa33de1fc7e
BLAKE2b-256 9c2ab9938a1020f2119d580a9627c8ffa8a593d3bf1dfc272832dd024b76a43d

See more details on using hashes here.

File details

Details for the file bitsig-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bitsig-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for bitsig-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47e4e0bf0cc4221bcfa7d545f1c9aa47344be0b4dbc7bde4ecaa70cfde936929
MD5 9d2e65be20090c437856b08f81fb1c84
BLAKE2b-256 28ca14c56a7b0883e4d19e3d3912eef8fdb27aa6fe9b75c7976a65949ba5aa54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page