Skip to main content

A production-grade, asynchronous logging decorator for Python.

Project description

🏔️ LogCrest

Transform your basic Python logs into a production-grade tracing system with just one line of code.

LogCrest is a "smart" logging library. It doesn't just print text; it tracks how your functions talk to each other, measures how long they take, and saves everything in a structured format that professional tools (like Datadog or ELK) love.


🌟 Why LogCrest?

If you are a beginner, logging usually looks like this: print("Something happened"). But in a real app, that's not enough. LogCrest gives you:

  • 🔄 Automatic Tracing: If Function A calls Function B, they get the same "ID". You can follow a single click through 10 nested functions easily.
  • ⚡ Super Fast: Logging can slow down your app. LogCrest does its "heavy lifting" (writing to disks) in the background so your app stays snappy.
  • 🎨 Human vs Machine: It shows colors in your terminal (for you) but saves JSON in your files (for the computer).
  • ⏱️ Stopwatch Built-in: Every log tells you exactly how many milliseconds your function took to run.

🚀 Quick Start (In 60 Seconds)

1. Install it

pip install logcrest

2. Use the "Smart Decorator"

Just put @log_decorator over any function you want to track.

from logcrest import log_decorator, log

@log_decorator
def process_order(item_id):
    log.info(f"Checking warehouse for item: {item_id}")
    return "Ordered!"

process_order(101)

What happens next?

  1. You'll see a Green [INFO] message in your terminal.
  2. A new logs/ folder will appear.
  3. Inside, you'll find a file with a professional JSON entry: {"timestamp": "...", "level": "INFO", "trace_id": "a1b2c3d4", "function": "process_order", "message": "..."}

🛠️ Advanced Features

1. Tracking Nested Calls

LogCrest is smart enough to link functions together.

@log_decorator
def sub_task():
    log.info("Doing the small job")

@log_decorator
def main_job():
    log.info("Starting big job")
    sub_task() # This will automatically share the same Trace ID!

2. Customizing Levels

Want to keep it quiet? Change the level:

@log_decorator(DEBUG) # Only show when you're deep-diving into bugs
def hidden_math():
    return 2 + 2

3. Handling Errors

If your function crashes, LogCrest catches it, logs the exact error and the time it happened, and then lets it crash gracefully. You'll never wonder "Which line broke?" again.


⚙️ Configuration (Optional)

LogCrest works right out of the box, but you can create a log_config.json in your project folder to change things:

{
  "base_log_dir": "my_custom_logs",
  "max_log_size": 10485760,
  "backup_count": 5,
  "use_json": true
}

👨‍💻 Contributing

This project was built with SOLID principles. If you're a developer:

  1. Clone the repo.
  2. Install dev tools: pip install -e ".[dev]"
  3. Run tests: pytest

LogCrest: Professional logging, simplified. ⛰️

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

logcrest-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

logcrest-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file logcrest-0.1.1.tar.gz.

File metadata

  • Download URL: logcrest-0.1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logcrest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d1b47eaf9b5a9e586abe9a2f3dddac1f292c683f59b46dc8486e7cc620928931
MD5 015c6145afc745d8fad11e28838d722f
BLAKE2b-256 3d40ed9b8a99ba25bea899af2d97900e751b712d632567e7611c49e65694cb69

See more details on using hashes here.

Provenance

The following attestation bundles were made for logcrest-0.1.1.tar.gz:

Publisher: publish.yml on snehangsude/LogCrest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logcrest-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logcrest-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logcrest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ed599f67c926d2571b44a8b51df156d8c59470619926ff8e45edf5dfbe40988
MD5 e0ed031252206e1b14ed797aa825b087
BLAKE2b-256 20fee909b973144619d0d41fb7b269a3cadb31f314b8129eb4ac121b5fe1daee

See more details on using hashes here.

Provenance

The following attestation bundles were made for logcrest-0.1.1-py3-none-any.whl:

Publisher: publish.yml on snehangsude/LogCrest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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