A modern Python logging library
Project description
redlog
a modern python logging library
features
- beautiful aligned output with automatic color detection
- structured logging with key-value fields
- immutable scoped loggers for hierarchical context
- thread-safe by design
- printf-style formatting support
- customizable themes and formatters
quick start
import redlog
log = redlog.get_logger("app")
log.info("hello world")
log.info("user login",
redlog.field("username", "alice"),
redlog.field("success", True))
db_log = log.with_name("database")
db_log.error("connection failed", redlog.field("host", "localhost"))
install
pip install redlog-py
usage
basic logging
log = redlog.get_logger("myapp")
log.critical("system failure")
log.error("something went wrong")
log.warn("potential issue")
log.info("general information")
log.debug("debugging details")
short forms
log.crt("critical") # same as critical()
log.err("error") # same as error()
log.inf("info") # same as info()
log.dbg("debug") # same as debug()
structured fields
log.info("user action",
redlog.field("user_id", 12345),
redlog.field("action", "login"),
redlog.field("ip", "192.168.1.100"))
scoped loggers
request_log = log.with_field("request_id", 12345) \
.with_field("method", "POST")
handler_log = request_log.with_name("handler")
handler_log.info("processing request")
printf-style formatting
log.info_f("user %s logged in from %s", username, ip_address)
log.error_f("failed to connect to %s:%d", host, port)
configuration
# set minimum log level
redlog.set_level(redlog.Level.DEBUG)
# use plain theme (no colors)
redlog.set_theme(redlog.themes.PLAIN)
development
poetry install
poetry run python examples/basic.py
poetry run pytest
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
redlog_py-0.1.0.tar.gz
(9.8 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
redlog_py-0.1.0-py3-none-any.whl
(11.5 kB
view details)
File details
Details for the file redlog_py-0.1.0.tar.gz.
File metadata
- Download URL: redlog_py-0.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bca7c5f0d62703359c21b92d2d50c0c8f761b7fbe9c50ce3a2ee3126375e054d
|
|
| MD5 |
1ae513071f93d3aedaa13be95d54d099
|
|
| BLAKE2b-256 |
cfa3e73cf2ce3023e9148bbcd7c8c5c6632b0cf565fd6c675e241fd3068f4ebc
|
File details
Details for the file redlog_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: redlog_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
398d0e4949fe64d1ef735f8f16f5dc9b90b3093f5463d6e15c29f1565266b13e
|
|
| MD5 |
7445bf9f7088aceee1503588e9e5b12e
|
|
| BLAKE2b-256 |
9fb622c7d8943e0f564d2fe0a70fb332abffbc815d8107cfaf798b99161f5e93
|