vcti-logging
Configurable logging with custom levels and color support for Python.
Overview
vcti-logging gives every script and service the same logging setup:
the same levels, the same formats, the same behavior. It configures one
package logger, vcti, from a list of handler descriptions — console,
file, or both — each with its own level and message format, and replaces
that configuration wholesale whenever it is called again. It adds two
levels to Python's standard set, TRACE (5) and VERBOSE (15), with
matching logger.trace() and logger.verbose() methods, optional colored
console output, and named format presets so callers rarely write a
%-style format string.
Installation
pip install vcti-logging
In requirements.txt
vcti-logging>=1.1.0
In pyproject.toml dependencies
dependencies = [
"vcti-logging>=1.1.0",
]
Quick Start
from pathlib import Path
from vcti.logging import ConsoleLogConfig, FileLogConfig, logger, setup_logging
# Console logging with color
setup_logging([
ConsoleLogConfig(log_level="trace", enable_color_log=True),
])
# Standard levels
logger.info("Application started")
logger.warning("Low disk space")
# Custom levels
logger.trace("Entering load() with path=%s", "model.h5")
logger.verbose("Processing item %d of %d", 3, 10)
# Reconfigure: console at INFO, everything from DEBUG up to a file
setup_logging([
ConsoleLogConfig(log_level="info", enable_color_log=True),
FileLogConfig(log_level="debug", file_path=Path("app.log")),
])
The same setup from keyword arguments, for callers that map command-line options straight through:
from vcti.logging import create_logging_config
setup_logging(create_logging_config(log_level="debug", log_file_path=Path("app.log")))
Log Levels
| Name | Value | Purpose |
|---|---|---|
"notset" |
0 | Pass every record |
"trace" |
5 | Step-by-step execution detail |
"debug" |
10 | Debug information |
"verbose" |
15 | Detailed, but less noisy than DEBUG |
"info" |
20 | General information (default) |
"warning" |
30 | Warning conditions |
"error" |
40 | Error conditions |
"fatal" |
50 | Fatal errors |
Configuration takes the names, case-insensitively. LogLevel is the
matching IntEnum; decode_log_level() and encode_log_level() convert
between the two.
Configuration
Message format presets
| Preset | Shows | Use case |
|---|---|---|
"minimal" |
message | CLI tools, clean output |
"standard" |
level + message | General use (default) |
"detailed" |
level + file + line + message | Debugging |
Each preset has a plain and a color variant; the right one is chosen from
enable_color_log. Any other string is used as a raw format:
ConsoleLogConfig(log_level="debug", enable_color_log=True, message_format="detailed")
ConsoleLogConfig(message_format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
File logging
Files are written as UTF-8 and opened in append mode; mode="w"
overwrites on each setup_logging() call. The parent directory must exist.
FileLogConfig(file_path=Path("app.log"), log_level="info", mode="w")
Console and file handlers are independent — each has its own level and preset, and file output never carries color codes:
setup_logging([
ConsoleLogConfig(log_level="info", enable_color_log=True, message_format="standard"),
FileLogConfig(log_level="debug", file_path=Path("app.log"), message_format="detailed"),
])
Child loggers
Modules log through children of vcti; their records reach the handlers
configured above, with no setup of their own:
import logging
app_logger = logging.getLogger("vcti.myapp")
app_logger.verbose("Application-specific message")
Import vcti.logging before creating them: loggers created earlier lack
trace() and verbose().
Pydantic models
LogLevelCoder bundles the level type, default and valid names for a
model field (requires pydantic, which this package does not depend on):
from pydantic import BaseModel, Field
from vcti.logging import LogLevelCoder
class AppConfig(BaseModel):
log_level: LogLevelCoder.Literal = Field(
default=LogLevelCoder.default,
description=f"Supported: {'/'.join(LogLevelCoder.list)}",
)
Public API
| Symbol | Purpose |
|---|---|
setup_logging(configs, propagate=False) |
Replace the vcti logger's handlers |
ConsoleLogConfig / FileLogConfig |
Describe one console or file handler |
create_logging_config(...) |
Build the config list from keyword arguments |
logger |
The package logger, named "vcti" |
CustomLevelLogger |
Logger class with trace() and verbose() |
LogLevel / LogLevelStr |
Level enum / Literal of level names |
decode_log_level(name) / encode_log_level(level) |
Name ↔ LogLevel |
DEFAULT_LOG_LEVEL_STR / LOG_LEVEL_VALUES |
"info" / every level name |
LogLevelCoder |
Level type, default, names and conversion in one object |
MESSAGE_FORMAT_PRESETS / MessageFormatPreset |
Preset formats / preset names |
resolve_message_format(fmt, color=False) |
Preset name or raw format → format string |
Dependencies
colorlog— colored console output.
Documentation
| If you want to… | Read |
|---|---|
| Get started using the package | Quick Start above |
| Understand the design decisions and their trade-offs | docs/design.md |
| Navigate and understand the source | docs/source-guide.md |
| Contribute, run the checks or the benchmarks | CONTRIBUTING.md |
Metadata
Release files for vcti-logging 1.1.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 |
|---|---|---|---|---|
| vcti_logging-1.1.0.tar.gz | 26.2 kB | With provenance | Details for vcti_logging-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vcti_logging-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for vcti_logging-1.1.0-py3-none-any.whl |
Total release size: 40.2 kB
Release files / vcti_logging-1.1.0.tar.gz
| Download URL | vcti_logging-1.1.0.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bb610942f1e0d2976b5cea6b3ff4679737e983f90cc06d1755fe8afda878b16
|
|
BLAKE2b-256 checksum How to use checksums |
38066702b5ffa52638f13752683bb2507498f2e01e7c80d0a3616509a4f77897
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logRelease files / vcti_logging-1.1.0-py3-none-any.whl
| Download URL | vcti_logging-1.1.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8012b65a90bbc120014ee3fc25aa2a11511103902be7325a8dbfa27c657066ed
|
|
BLAKE2b-256 checksum How to use checksums |
14a2377d67e800982cea224f20ae5aa0642a90aefaa4f8c599bedf800aec81a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logSecurity for vcti-logging 1.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vcti_logging-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logA 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.