Logging Framework
Purpose
VCollab applications need consistent logging across all scripts and
services — same log levels, same format, same behavior. The
vcti-logging package provides configurable logging with custom log
levels (TRACE, VERBOSE), color output, and flexible handler
configuration for console and file targets.
Dependencies: colorlog (for colored console output)
Installation
# Latest main branch
pip install vcti-logging
### In `requirements.txt`
vcti-logging>=1.0.5
### In `pyproject.toml` dependencies
```toml
dependencies = [
"vcti-logging>=1.0.5",
]
Quick Start
from pathlib import Path
from vcti.logging import logger, setup_logging
from vcti.logging.config import ConsoleLogConfig, FileLogConfig
# Setup console logging with color
setup_logging([
ConsoleLogConfig(log_level="debug", enable_color_log=True),
])
# Log at standard levels
logger.info("Application started")
logger.warning("Low disk space")
logger.error("Connection failed")
# Log at custom levels
logger.trace("Entering function X with args: %s", args)
logger.verbose("Processing item %d of %d", i, total)
# Setup console + file logging
setup_logging([
ConsoleLogConfig(log_level="info", enable_color_log=True),
FileLogConfig(log_level="debug", file_path=Path("app.log")),
])
Log Levels
| Level | Value | Purpose |
|---|---|---|
TRACE |
5 | Very detailed diagnostic output |
DEBUG |
10 | Debug information |
VERBOSE |
15 | Detailed but less noisy than DEBUG |
INFO |
20 | General information |
WARNING |
30 | Warning conditions |
ERROR |
40 | Error conditions |
FATAL |
50 | Critical/fatal errors |
All levels are available as strings for configuration: "trace",
"debug", "verbose", "info", "warning", "error", "fatal".
Configuration
Message Format Presets
Instead of writing raw format strings, use named presets:
| Preset | What it shows | Use case |
|---|---|---|
"minimal" |
message only | CLI tools, clean output |
"standard" |
level + message | general development (default) |
"detailed" |
level + file + line + message | debugging |
Each preset has a plain and color variant — the correct one is selected
automatically based on enable_color_log.
You can also pass a raw format string (e.g.,
"%(asctime)s - %(levelname)s - %(message)s") if presets don't fit your
needs.
Console logging
from vcti.logging.config import ConsoleLogConfig
# Using a preset (recommended)
config = ConsoleLogConfig(
log_level="debug",
enable_color_log=True,
message_format="detailed",
)
# Using a raw format string
config = ConsoleLogConfig(
log_level="debug",
message_format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
File logging
from pathlib import Path
from vcti.logging.config import FileLogConfig
config = FileLogConfig(
file_path=Path("logs/application.log"),
log_level="info",
message_format="standard",
)
By default, the file handler opens in append mode ("a"). To overwrite
the file on each run, set mode="w":
config = FileLogConfig(
file_path=Path("logs/application.log"),
log_level="info",
mode="w",
)
Combined with different presets
Console and file handlers can use different presets independently:
from pathlib import Path
from vcti.logging import setup_logging
from vcti.logging.config import ConsoleLogConfig, FileLogConfig
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"),
])
Public API
| Symbol | Purpose |
|---|---|
setup_logging(configs) |
Configure logging handlers |
logger |
Pre-configured logger instance (name: "vcti") |
MESSAGE_FORMAT_PRESETS |
Available format presets (minimal, standard, detailed) |
resolve_message_format(fmt) |
Resolve a preset name or raw format string |
LogLevel |
IntEnum of all log levels |
LogLevelStr |
Literal type for valid level strings |
decode_log_level(name) |
String to LogLevel enum |
encode_log_level(level) |
LogLevel enum to string |
LogLevelCoder |
Convenience class for Pydantic models |
CustomLevelLogger |
Logger class with trace()/verbose() methods |
Child Loggers
The package logger is named "vcti". Application code should create
child loggers to keep log output identifiable:
import logging
app_logger = logging.getLogger("vcti.myapp")
app_logger.info("Application-specific message")
Child loggers inherit handlers and levels from the parent — no extra
setup_logging() call is needed.
LogLevelCoder for Pydantic Models
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)}",
)
Benchmarks
pip install -e ".[bench]"
python benchmarks/benchmark_logging.py
See CONTRIBUTING.md for details.
Documentation
- Design — Architecture decisions and custom level design
- Source Guide — File descriptions and execution flows
- API Reference — Autodoc for all modules
Metadata
Release files for vcti-logging 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vcti_logging-1.0.5.tar.gz | 18.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vcti_logging-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 kB
Release files / vcti_logging-1.0.5.tar.gz
| Download URL | vcti_logging-1.0.5.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3461b3291f1bfd0cfe8fb68fd064c3c2fce47c15b1bdf92f1ffeba70e2898ad5
|
|
BLAKE2b-256 checksum How to use checksums |
fab9a8f5100f43f14eecd676de5ed70399f2115a41a3559b6ad3c7dadc2df7e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 22, 2026.
Transparency logRelease files / vcti_logging-1.0.5-py3-none-any.whl
| Download URL | vcti_logging-1.0.5-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a33ba0dea0292e676725c7cafc7b871dbf63b5fd44b94d720287159b1419b4d
|
|
BLAKE2b-256 checksum How to use checksums |
c32c2fa9d9a9b809b37e55a4e36e95ef5424a5c594f33a6f26186f56b6da5fe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 22, 2026.
Transparency log