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.1.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.1-py3-none-any.whl
(11.5 kB
view details)
File details
Details for the file redlog_py-0.1.1.tar.gz.
File metadata
- Download URL: redlog_py-0.1.1.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 |
879aba748f385d99b227e3e50fd180e37ee04ce20810ea03184a435c3b75932b
|
|
| MD5 |
56035899ea3e848db28371cb249c70cc
|
|
| BLAKE2b-256 |
390009a17b1914d461dcc4a59000a6fa05d00836fd87c9d30cd992f3bf167ae5
|
File details
Details for the file redlog_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: redlog_py-0.1.1-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 |
a7160976cff45739b1fe02afc30e0022e2ed6312e7cf82414f886497cf811ba3
|
|
| MD5 |
ca1c9f8d80aded691c400e56808a07e7
|
|
| BLAKE2b-256 |
124a882b5e29d9bf81bb1b83bcae8c8714d0759c3f638f20bf27c1c0a05a0279
|