small-logger
A tiny, opinionated Loguru wrapper that gives your Python apps a consistent, readable log format in two lines of code.
2026-05-11 14:32:01 | INFO | myapp:main:42 | Server started on port 8080
2026-05-11 14:32:01 | ERROR | myapp:handle_request:87 | Connection refused
| Traceback shown below
Installation
uv add small-logger
pip install small-logger
Quick start
from small_logger import init_logger, get_logger
init_logger() # call once at the start of your app
logger = get_logger()
logger.info("Server started")
logger.warning("Disk usage above 80%")
File logging
Pass your app's name to enable automatic file logging:
init_logger(app_name="my-app")
Logs are written to the platform-appropriate directory:
| Platform | Path |
|---|---|
| Windows | %LOCALAPPDATA%\my-app\Logs\app.log |
| macOS | ~/Library/Logs/my-app/app.log |
| Linux | ~/.local/state/my-app/log/app.log |
Files rotate daily at midnight, are kept for 7 days, and are compressed to .zip on rotation.
API
init_logger
init_logger(
level="INFO", # TRACE | DEBUG | INFO | SUCCESS | WARNING | ERROR | CRITICAL
app_name=None, # enables file logging when provided
file=None, # override file logging on/off explicitly
)
| Parameter | Default | Description |
|---|---|---|
level |
"INFO" |
Minimum level to log. |
app_name |
None |
App name for the log file path. When set, file logging is enabled by default. |
file |
None |
Explicitly enable (True) or disable (False) file logging, regardless of app_name. |
Call this once at startup. Subsequent calls are no-ops.
get_logger
logger = get_logger()
logger = get_logger(request_id="abc123", user_id=42)
Returns a Loguru logger bound with optional key-value context. The context is included in every message emitted through that logger instance.
Multiline messages
Continuation lines are automatically indented to align with the first line:
logger.info("Query returned 3 rows:\nrow1\nrow2\nrow3")
2026-05-11 14:32:01 | INFO | myapp:run:10 | Query returned 3 rows:
| row1
| row2
| row3
License
MIT
Metadata
Release files for small-logger 0.1.0
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 | Actions |
|---|---|---|---|---|
| small_logger-0.1.0.tar.gz | 4.9 kB | Without provenance | Details for small_logger-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| small_logger-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for small_logger-0.1.0-py3-none-any.whl |
Total release size: 11.1 kB
Release files / small_logger-0.1.0.tar.gz
| Download URL | small_logger-0.1.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22d387ba1c464f7d40977fae4a131ec6d625e56a116a5f8c063ad4e219b48a7a
|
|
BLAKE2b-256 checksum How to use checksums |
be3e77270ce9694e54ae3a171b23fb6e837ff7c4dc5273c1d282790a6a4ca308
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.6
|
Release files / small_logger-0.1.0-py3-none-any.whl
| Download URL | small_logger-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e65ba0803e56a9c57c21bb0ca315f72fc530ab05e745a0f2002b2e003c3e62d
|
|
BLAKE2b-256 checksum How to use checksums |
758ab6ffbee7c6c6f0b139b5c842ed2151bc4ef03df6c62ca5545362b380e6ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.6
|
Security for small-logger 0.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.