logging-bullet-train
A bullet-train style Python logging utility with colorful, emoji-enhanced log messages.
Documentation: https://allen2c.github.io/logging-bullet-train/
Features
- Colorful log levels and readable segment separators.
- ISO-8601 timestamps with
zoneinfotimezone support. - 45 built-in emoji themes plus custom theme mappings.
- Idempotent logger setup to avoid duplicate log lines.
- Configurable stream, color mode, propagation, and visible format sections.
Installation
pip install logging-bullet-train
For development:
poetry install --with dev
Usage
import logging
import logging_bullet_train as lbt
logger = lbt.set_logger("my_logger", level=logging.DEBUG)
logger.debug("debug message")
logger.info("info message")
logger.warning("warning message")
logger.error("error message")
logger.critical("critical message")
logger.log(1, "unknown message")
Sample output:
2026-04-27T08:08:12+00:00 🔎 DEBUG my_logger:8 debug message
2026-04-27T08:08:12+00:00 💡 INFO my_logger:9 info message
2026-04-27T08:08:12+00:00 ⭐ WARNING my_logger:10 warning message
Configuration
import logging
import sys
from logging_bullet_train import set_logger
logger = set_logger(
"app",
level="INFO",
theme="rocket",
color="auto",
stream=sys.stderr,
timezone="Asia/Taipei",
show_datetime=True,
show_logger_name=True,
show_lineno=True,
propagate=False,
)
Logging defaults to stderr, which is the usual choice for logs because it keeps
program output on stdout clean for shell pipelines.
Themes
Use a named theme:
logger = set_logger("app", theme="terminal")
Built-in themes:
from logging_bullet_train import level_emojis
print(sorted(level_emojis))
Use a custom theme mapping:
import logging
logger = set_logger("app", theme={logging.INFO: "ok"})
Custom themes are merged with the default theme, so you only need to override the levels you care about.
Color
set_logger("app", color=True)
set_logger("app", color=False)
set_logger("app", color="auto")
set_logger("app", color="always")
set_logger("app", color="never")
"auto" enables color only for TTY streams and respects the NO_COLOR
environment variable.
Format Sections
set_logger(
"app",
show_datetime=False,
show_logger_name=False,
show_lineno=False,
)
Logger Attributes
set_logger("app", propagate=False, disabled=False)
set_logger() also avoids adding duplicate bullet-train handlers when called
more than once for the same logger and stream. Pass replace_handlers=True to
replace existing bullet-train handlers.
Manual Handler Setup
import logging
from logging_bullet_train import BulletTrainFormatter
handler = logging.StreamHandler()
handler.setFormatter(BulletTrainFormatter(theme="weather", color="auto"))
logger = logging.getLogger("manual")
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
Documentation
The documentation site is built with MkDocs Material.
Serve it locally:
poetry run mkdocs serve
Build it strictly:
poetry run mkdocs build --strict
GitHub Actions builds and deploys GitHub Pages when main is pushed.
License
MIT. See LICENSE.
Metadata
Release files for logging-bullet-train 0.4.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 |
|---|---|---|---|---|
| logging_bullet_train-0.4.0.tar.gz | 9.5 kB | Without provenance | Details for logging_bullet_train-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logging_bullet_train-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for logging_bullet_train-0.4.0-py3-none-any.whl |
Total release size: 20.0 kB
Release files / logging_bullet_train-0.4.0.tar.gz
| Download URL | logging_bullet_train-0.4.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98e9b55e2e42764519a5030e6b0b4eee984c652af47a368580be89f23343959d
|
|
BLAKE2b-256 checksum How to use checksums |
7ed0599f6b188b2034b408d14e8d369cbc603465b00904f8190454c01ce4e6f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.4 CPython/3.12.13 Darwin/25.3.0
|
Release files / logging_bullet_train-0.4.0-py3-none-any.whl
| Download URL | logging_bullet_train-0.4.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
529cc8935566c31536877410aa8d14291d0cb82445a19776c6b2f0ede246caf4
|
|
BLAKE2b-256 checksum How to use checksums |
420040932aea742aba10135c197e953e23c71bee54b5a9f07bd3ab5c6e09e016
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.4 CPython/3.12.13 Darwin/25.3.0
|
Security for logging-bullet-train 0.4.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.