Simple, performant logging with ANSI colors for Python.
Project description
ezlogger
Simple, performant logging with ANSI colors for Python.
- 5 levels:
error,warn,info,success,debug - Short aliases:
e,w,i,s,d - ANSI colors: red, yellow, cyan, green, magenta
- Config: levels on/off, colors, symbols vs text, timestamp
- Safe serialization: circular refs, dates, exceptions
- Zero dependencies
Install
pip install -e .
Usage
from ezlogger import EzLog, log
# Default instance (debug off in production via ENV=production)
log.success("Application started")
log.info("Environment: dev")
log.w("Warning")
log.e("Error")
log.d("Debug")
# Custom config
logger = EzLog({
"levels": {"error": True, "warn": True, "info": True, "success": True, "debug": False},
"useColors": True,
"useLevels": True,
"useSymbols": False,
"useTimestamp": True,
})
logger.configure({"useTimestamp": False})
# Objects and errors
log.info("User:", {"id": 1, "name": "John"})
log.error("Failed", Exception("Connection failed"))
# Error handler for routers (e.g. FastAPI/Starlette)
from ezlogger import create_error_handler
on_error = create_error_handler()
on_error(exception, request)
Config
| Option | Description |
|---|---|
levels |
Enable/disable per level |
useColors |
ANSI colors on/off |
useLevels |
Show level label before message |
useSymbols |
Use symbols (x, !, i, ✓, d) or text |
useTimestamp |
ISO timestamp before message |
Exports
EzLog– logger classlog– default instance (debug off whenENV=production)create_error_handler(is_http_error=..., get_method=..., get_url=...)– for router error callbacks- Types:
LogLevel,LogColors,EzlogConfig,LevelConfig,LogArgs,ConsoleMethod
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
ezlog_py-0.1.0.tar.gz
(5.7 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 ezlog_py-0.1.0.tar.gz.
File metadata
- Download URL: ezlog_py-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c597166e71f7ffe7fa596f4c9c54e60efafc6398b481567467525dfb4388c56
|
|
| MD5 |
71b819c4ae583e07fdcee81b9d883941
|
|
| BLAKE2b-256 |
6fe7c0548753e66fbb3605f1277b2afbb2f67d1da9c9bad472fb61ec9956fcb5
|
File details
Details for the file ezlog_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ezlog_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0719f367b5754be0490ce12096dc8e6cc791424cf722c6b45056320d347ab274
|
|
| MD5 |
b4f8244f6a0dfe2a653d6e054c6400da
|
|
| BLAKE2b-256 |
d94ce53509ba04bbb6d97b0d1f0227b606a99187da3052f80ee124100174a153
|