LAPLACE Log (LAPLACE-LHC)
A small, opinionated logging helper built on top of Python’s standard logging module.
laplace_log is designed for multi-module / multi-process scientific or application projects where you want:
- One central logger initialization
- Logs from your app + third‑party libraries
- Clear application names in logs (e.g.
laplace.opt) - Automatic daily log folders
- Simple
log.info(...)usage everywhere print()statements captured into logs
No external dependencies — just structured, predictable logging.
Features
- ✅ Root logger configuration (captures library logs)
- ✅ Application‑named logger (
app_name) - ✅ File + console handlers with independent levels
- ✅ Automatic folder structure:
logs/YYYY-MM-DD/app_name.log - ✅
print()andstderrredirection into logs - ✅ Simple
log.info(...)helper available - ✅ Singleton design (initialize once, use everywhere)
- ✅ Provide an error hook (to avoid silent failures such as PyQt signals)
- ✅ If the logger is not set, the
log.example(...)will act as aprint(...)
Installation
Install with pip:
pip install laplace-log
Quick Start
1. Initialize the logger once (entry point)
from laplace_log import LoggerLHC, log
LoggerLHC(
app_name="laplace.opt",
log_root=None,
file_level="debug",
console_level="info",
)
log.info("Starting OptWindow...")
2. Use logging anywhere
from laplace_log import log
log.debug("Debug message")
log.info("Information")
log.warning("Something looks odd")
log.error("Something went wrong")
No need to pass logger instances around.
Log Output Example
2026-01-20 10:21:47 [INFO] [laplace.opt] Starting OptWindow...
2026-01-20 10:21:48 [WARNING] [numpy] overflow encountered in exp
2026-01-20 10:21:49 [INFO] [root] A print statement
- App logs use your
app_name - Library logs keep their original logger names
- print() statements appear as
root
Folder Structure
logs/
└── 2026-01-20/
└── laplace_opt.log
- A new folder is created each day
- Dots in
app_nameare replaced by underscores for filenames
Design Overview
Root logger
The root logger is configured with:
- File handler (persistent logs)
- Console handler (stdout)
This ensures all third‑party libraries are captured automatically.
Application logger
Each app uses its own named logger:
logging.getLogger("laplace.opt")
This name appears in log records and helps identify the source clearly.
The log Helper
log is a lightweight helper object:
from laplace_log import log
log.info("Hello")
Internally, it forwards calls to the initialized LoggerLHC instance.
If log is used before initialization of LoggerLHC, the message is printed.
Print Redirection
All print() and sys.stderr output is redirected:
- Printed normally to the console
- Also logged at
INFOlevel via the root logger
This is useful for:
- Legacy code
- Debug prints
- Third‑party libraries using
print
Error Hook
To avoid silent failures, an error hook can be loaded:
from laplace_log import uncaught_exception
This import will by itself make sure that no error will be missed. This is especially useful for PyQt signal errors.
Configuration Options
LoggerLHC(
app_name: str,
log_root: Path | str | None = None,
file_level: str = "debug",
console_level: str = "info",
)
| Parameter | Description |
|---|---|
app_name |
Logical name of your application (laplace.opt, lapalce.server, …) |
log_root |
Base folder for logs (default: current working directory) |
file_level |
Minimum level written to file |
console_level |
Minimum level printed to console |
Intended Use Cases
- Scientific applications (optimization, simulations, experiments)
- Multi‑process systems (master / worker / optimizer)
- GUI + backend projects
- Long‑running experiments
- Any project needing clean, centralized logs
License
GPL-3.0 license
Metadata
Release files for laplace-log 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| laplace_log-0.1.5.tar.gz | 18.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| laplace_log-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.8 kB
Release files / laplace_log-0.1.5.tar.gz
| Download URL | laplace_log-0.1.5.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c54f20805f88bbc0794035ffc36928a5dca5e1436558bd9c6cb9dcbaecbc61ea
|
|
BLAKE2b-256 checksum How to use checksums |
640eff8176d273089b8c038a9e7b7294f2ac0b068a9d1ce9dce090d1e1a9051e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / laplace_log-0.1.5-py3-none-any.whl
| Download URL | laplace_log-0.1.5-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31b2689fe94d1cf482b56aae214daee683a3b3e68a9ea9b368df5db3af95b98e
|
|
BLAKE2b-256 checksum How to use checksums |
d4eff3581fd9db1215188524f43efc62221abc311cae98125f7bcffb12de70ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for laplace-log 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.