Advanced Python logger with lifecycle tracking, signing, multi‑instance log merging, and optional single‑instance protection.
Project description
jvlogger
A production‑ready Python logger with multi‑instance support, colored console output, JSON log files, daily rotation, optional Windows single‑instance protection, log merging, lifecycle tracking, JSON signing and global exception hooks.
Features
- Colored console logs – easy to read during development.
- JSON log files – structured logs for downstream processing.
- Daily rotation – automatic log file rollover at midnight.
- Windows single‑instance protection (optional) – prevents multiple processes from writing to the same file.
- Multi‑instance log merging – temporary logs are merged into the primary log on shutdown.
- Lifecycle tracking – records CPU/RAM usage at start and stop.
- JSON log signing – optional cryptographic signing of log entries.
- Global exception hooks – uncaught exceptions are logged automatically.
Installation
pip install jvlogger
Quick start
from jvlogger import JVLogger
from app import main
# Simple usage as a context manager
with JVLogger(name="my_app") as jv:
logger = jv.get_logger()
logger.info("Application started")
main(logger, args)
Explicit usage
# Create a wrapper without the context manager
jv = JVLogger(name="my_app", single_instance=False)
logger = jv.get_logger()
logger.debug("Debug message")
# Remember to close the wrapper to merge temporary logs
jv.close()
API reference
JVLogger(name: str = None, level: int = logging.INFO, install_excepthooks: bool = True, single_instance: bool = False, mutex_name: str = None, signer: Signer = None, log_dir: str = None, lifecycle: bool = False)– creates and configures the logger.JVLogger.get_logger()– returns the underlyinglogging.Loggerinstance.- Standard logging methods (
debug,info,warning,error,critical,exception,log) are proxied to the wrapped logger. JVLogger.close()– flushes handlers, merges temporary logs (if applicable) and releases any locks.
Contributing
Contributions are welcome! Please open issues or pull requests on the GitHub repository. Follow the usual fork‑branch‑pull‑request workflow and ensure that new code is covered by tests.
License
MIT License – see the LICENSE file for details.
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 jvlogger-0.1.3.tar.gz.
File metadata
- Download URL: jvlogger-0.1.3.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
682c73edc0f1a29af86d265a5671444c5c973a55ccbef8f154c40cbe1345d7f4
|
|
| MD5 |
5d4db055930ec9b0228c7ff927134422
|
|
| BLAKE2b-256 |
2adfa95e84894c1429e5f2eb741e04f1ee6fbf96b04bf236385aa911ac14bdcb
|
File details
Details for the file jvlogger-0.1.3-py3-none-any.whl.
File metadata
- Download URL: jvlogger-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29eb769b6f37eef9a662194e4a9f5b8e3e5382e402e7bcb0ea1b13d43f996a3b
|
|
| MD5 |
37016efefdcbe54f88158eeaafe4b420
|
|
| BLAKE2b-256 |
a3304b002c40cb682ee7d2bad55d9d36db41f0406c622c54ba5a7fe6a9c792be
|