Skip to main content

A Black Box Flight Recorder for Python applications.

Project description

lognote - Black Box Flight Recorder

lognote is a high-performance, threading-safe, zero-dependency "Black Box Flight Recorder" for Python applications. Designed specifically for production environments, it captures essential execution paths, performance metrics, and state-at-crash information without slowing down your host application.

Why lognote?

When a critical application crashes in production, having an exact playback of what happened is invaluable. However, tracing tools usually require external setups and carry a heavy performance hit or many dependencies. lognote runs entirely in the Python Standard Library, logging safely inside a lightweight memory buffer (limited to the last 100 events). It strictly monitors for performance bottlenecks and captures local frame variables right before a stack unrolls in severe crashes, meaning no more flying blind. Plus, lognote comes with an automatic Privacy Filter, ensuring passwords, tokens, and secret keys never leak into your logs.

Quick Start

Installation

Until published on PyPI, you can build it locally:

pip install .

Usage

from lognote import trace, monitor, report

# 1. Trace function calls and return values
@trace
def process_payment(user_id: str, secret_token: str, amount: float):
    return {"status": "success", "amount": amount}

# The Privacy Filter will automatically redact "secret_token"
process_payment("u123", "sk_live_123456789", 45.0)

# 2. Monitor code block performance
def heavy_computation():
    with monitor("Data Crunching Task"):
        # Simulated workload
        for i in range(1000000):
            pass

heavy_computation()

# 3. Capture crashes with exact locals
@trace
def faulty_function(my_password: str):
    x = 10
    y = 0
    # On crash, lognote captures x=10, y=0, and my_password="[REDACTED]"
    return x / y

try:
    faulty_function("my_super_secret_password")
except ZeroDivisionError:
    pass

# 4. Export the session locally
# Generates a JSON (or Markdown) report in the .lognote_logs directory
report_path = report(format="json")
print(f"Log saved to {report_path}")

Author

Vishal N LinkedIn

Feel free to reach out for collaborations or questions!

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

lognote-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

lognote-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lognote-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for lognote-0.1.0.tar.gz
Algorithm Hash digest
SHA256 67f1945ce30d59a42226f701c179be2749af146fbe0f1c69f4bf2a3b4dc026f3
MD5 4d8a0f8ad2018a12e129f21da0e7759d
BLAKE2b-256 228a3714bfd08408b82cb3051c4a8581fa20d96f029d47d8318edbf4e0ed1229

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lognote-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for lognote-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39eb18767a0f7dcb60290c0148af1065d0811d6e86a75d3a90ae46b2323e4ab5
MD5 9fc04cc047f19a4e3409f41862a0968d
BLAKE2b-256 93c5c89d4fe8433919544b1f9c03f416b804bd5914314c350435dfdd83a9efe9

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