A small stdlib logging auto-configuration kit with colored multiline logs and log-once helpers.
Project description
stdlogkit
stdlogkit is a tiny, vLLM-independent wrapper around Python's standard
logging package.
Importing it configures standard logging immediately:
import logging
import stdlogkit # noqa: F401
logger = logging.getLogger(__name__)
logger.info("hello")
logger.warning_once("this warning appears once")
Default output:
INFO 06-24 12:00:01 [example.py:5] hello
WARNING 06-24 12:00:01 [example.py:6] this warning appears once
Features
- Uses only Python's standard
loggingmachinery. - Auto-configures logging on
import stdlogkit. - Configures the root logger by default, so normal
logging.getLogger(...)calls work immediately. - Adds
debug_once,info_once, andwarning_onceto standard logger instances. - Supports multiline log alignment.
- Supports ANSI colors with
auto, forced-on, and forced-off modes. - Supports custom JSON config through
logging.config.dictConfig. - Includes optional uvicorn access-log filtering helpers.
- Has no runtime dependency on vLLM or any other third-party package.
Environment Variables
| Variable | Default | Description |
|---|---|---|
STDLOGKIT_CONFIGURE_LOGGING |
1 |
Set 0 to disable auto configuration. |
STDLOGKIT_LOGGING_LEVEL |
INFO |
Root or named logger level. |
STDLOGKIT_LOGGING_STREAM |
ext://sys.stdout |
Handler stream. |
STDLOGKIT_LOGGING_PREFIX |
empty | Prefix prepended to every log line. |
STDLOGKIT_LOGGING_COLOR |
auto |
auto, 1, or 0. |
STDLOGKIT_LOGGING_CONFIG_PATH |
unset | Path to a JSON dictConfig file. |
STDLOGKIT_LOGGER_NAME |
empty | Configure a named logger instead of root. |
STDLOGKIT_ROOT_DIR |
current working directory | Base path for relative file display. |
STDLOGKIT_SHOW_REL_PATH |
debug |
debug, always, or never. |
NO_COLOR |
0 |
Standard flag to disable ANSI colors. |
Custom JSON Config
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"plain": {
"class": "stdlogkit.formatter.NewLineFormatter",
"format": "%(levelname)s %(asctime)s [%(fileinfo)s:%(lineno)d] %(message)s",
"datefmt": "%m-%d %H:%M:%S"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "plain",
"level": "INFO",
"stream": "ext://sys.stdout"
}
},
"root": {
"handlers": ["console"],
"level": "INFO"
}
}
Run with:
STDLOGKIT_LOGGING_CONFIG_PATH=/path/to/logging.json python app.py
Named Logger Mode
By default, stdlogkit configures the root logger. If you want behavior closer to a framework-specific logger, configure only a named logger:
STDLOGKIT_LOGGER_NAME=my_app python app.py
Then loggers under my_app.* propagate to that logger:
import logging
import stdlogkit # noqa: F401
logger = logging.getLogger("my_app.service")
logger.info("hello")
Development
cd standalone_logging_pkg
uv venv --python 3.12
uv pip install -e ".[dev]"
.venv/bin/python -m pytest -q
uv build
Publish to PyPI
Before publishing, make sure the project name in pyproject.toml is available
on PyPI and replace the placeholder author/repository metadata.
cd standalone_logging_pkg
uv build
uv publish --token "$PYPI_TOKEN"
For TestPyPI:
uv publish --publish-url https://test.pypi.org/legacy/ --token "$TEST_PYPI_TOKEN"
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
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 stdlogkit-0.1.0.tar.gz.
File metadata
- Download URL: stdlogkit-0.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":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 |
54ff97fe2f8c4e70f7f0789185c693e300de796a2cf57495ef8a3f37cc636d5b
|
|
| MD5 |
262e0e10026ee2a1ee89c878e73beb6c
|
|
| BLAKE2b-256 |
c6ba6cc58a896746e796a6001ee26a34af2ffe3366ce174a4688477e960bd6ab
|
File details
Details for the file stdlogkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stdlogkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":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 |
c688a3e42a73f129345fe11479fd2d52d048a98a25db640ddbdec371a3312051
|
|
| MD5 |
566db1314b7befd67e2c8337a5aece26
|
|
| BLAKE2b-256 |
125e7a913f43d7b9121c43cc7e19efdb149e12f6d1a4acb19ca6c2fc33764b88
|