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?
- You'll see a Green [INFO] message in your terminal.
- A new
logs/folder will appear. - 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:
- Clone the repo.
- Install dev tools:
pip install -e ".[dev]" - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1b47eaf9b5a9e586abe9a2f3dddac1f292c683f59b46dc8486e7cc620928931
|
|
| MD5 |
015c6145afc745d8fad11e28838d722f
|
|
| BLAKE2b-256 |
3d40ed9b8a99ba25bea899af2d97900e751b712d632567e7611c49e65694cb69
|
Provenance
The following attestation bundles were made for logcrest-0.1.1.tar.gz:
Publisher:
publish.yml on snehangsude/LogCrest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logcrest-0.1.1.tar.gz -
Subject digest:
d1b47eaf9b5a9e586abe9a2f3dddac1f292c683f59b46dc8486e7cc620928931 - Sigstore transparency entry: 775040031
- Sigstore integration time:
-
Permalink:
snehangsude/LogCrest@0ba5057b78cdb71031725892ab731efa79a0b234 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/snehangsude
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0ba5057b78cdb71031725892ab731efa79a0b234 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ed599f67c926d2571b44a8b51df156d8c59470619926ff8e45edf5dfbe40988
|
|
| MD5 |
e0ed031252206e1b14ed797aa825b087
|
|
| BLAKE2b-256 |
20fee909b973144619d0d41fb7b269a3cadb31f314b8129eb4ac121b5fe1daee
|
Provenance
The following attestation bundles were made for logcrest-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on snehangsude/LogCrest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logcrest-0.1.1-py3-none-any.whl -
Subject digest:
1ed599f67c926d2571b44a8b51df156d8c59470619926ff8e45edf5dfbe40988 - Sigstore transparency entry: 775040038
- Sigstore integration time:
-
Permalink:
snehangsude/LogCrest@0ba5057b78cdb71031725892ab731efa79a0b234 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/snehangsude
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0ba5057b78cdb71031725892ab731efa79a0b234 -
Trigger Event:
push
-
Statement type: