No project description provided
Project description
loguru_wrapper
A lightweight wrapper around loguru that provides lazy evaluation and automatic caller context detection.
Features
- Lazy Evaluation: Log arguments are only evaluated if the log level is enabled
- Automatic Caller Detection: Shows actual function name and line number in logs
- Format Conversion: Automatically converts
%sformat strings to{}format - Full Loguru Support: All log levels (debug, info, success, warning, error, critical)
- Structured Logging: Built-in structured logging support
Installation
pip install -e /path/to/loguru_wrapper
Quick Start
from loguru_wrapper import logger
def my_function():
log = logger()
log.debug("User: {}", get_username) # Lazy evaluation
log.info("Processing %s items", item_count) # Format conversion
log.structured("user_login", user_id=123, success=True)
Output:
2025-07-17 09:18:27.409 | DEBUG | my_module:my_function:42 | User: john_doe
2025-07-17 09:18:27.429 | INFO | my_module:my_function:43 | Processing 5 items
2025-07-17 09:18:27.449 | INFO | my_module:my_function:44 | EVENT=user_login user_id=123 success=True
Configuration
from loguru_wrapper import logger, LoggerConfig
config = LoggerConfig(
default_level="DEBUG",
enable_lazy=True
)
log = logger(config=config)
Requirements
- Python ≥ 3.10
- loguru ≥ 0.7.3
- stackwalker ≥ 0.4.2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
loguru_wrapper-0.3.0.tar.gz
(9.9 kB
view details)
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 loguru_wrapper-0.3.0.tar.gz.
File metadata
- Download URL: loguru_wrapper-0.3.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75f7fe2f872d01915aaae4e7ecd5269a2d044d441f01d30302512a91bde8a3ea
|
|
| MD5 |
d499c74223995c1dfb20d30ec0e3e518
|
|
| BLAKE2b-256 |
72f01f596fc3d90b9ceb19e45b34b4152e8d2750ac38f61d739461e575f024f8
|
File details
Details for the file loguru_wrapper-0.3.0-py3-none-any.whl.
File metadata
- Download URL: loguru_wrapper-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd2cb2fa7243078a564478018e1ab82cd25cc3cb7202c107b5928b1b03a63716
|
|
| MD5 |
7663d9aa628b612ae3a8054bbdb32890
|
|
| BLAKE2b-256 |
e6ae698061e889914a8c28f6d7d3228125ecea803e9253a1567955ca41a81672
|