tracecolor
Enhanced Python logger with colorized output, TRACE/PROGRESS levels, UDP monitoring, and file logging. Powered by Loguru backend for superior performance and features.
Features
Core Features
- Custom TRACE logging level (lower than DEBUG)
- Custom PROGRESS logging level (between DEBUG and INFO)
- Colorized output for different log levels
- Rate-limiting for PROGRESS messages (once per second per call site)
- Simple and clean API
Enhanced Features
- Pure Loguru Backend: Superior performance and features
- UDP Remote Monitoring: Real-time log streaming with
tracecolor-monitorcommand - File Logging: Automatic rotation, compression, and retention
- Automatic Configuration: Auto-detects
.tracecolor,tracecolor.toml,tracecolor.yml,tracecolor.json - Multi-format Support: TOML/YAML/JSON configuration with automatic format detection
- Multiple Destinations: Simultaneous logging to console, file, and UDP
- Automatic Dependencies: Loguru installed automatically with pip install
- Console Script:
tracecolor-monitoravailable globally after installation - Enterprise Ready: Thread-safe, async support, production-grade
Installation
# Recommended
uv pip install tracecolor
# Or with pip
pip install tracecolor
This automatically installs:
loguru- Advanced logging backendcolorlog- Colorized console output
Optional Dependencies
# For YAML configuration support
uv pip install tracecolor[yaml]
# For development
uv pip install tracecolor[dev]
Usage
Basic Usage
from tracecolor import tracecolor
# Create a logger
logger = tracecolor(__name__)
# Log at different levels
logger.trace("Detailed tracing information")
logger.debug("Debugging information")
logger.progress("Progress update information (rate-limited)")
logger.info("General information")
logger.warning("Warning message")
logger.error("Error message")
logger.critical("Critical error")
Enhanced Usage (v0.6.0 Features)
from tracecolor import tracecolor
# Standard usage now automatically uses Loguru backend if available
logger = tracecolor(__name__) # Now powered by Loguru!
logger.info("Better performance, same API")
# Enhanced features explicitly enabled
logger = tracecolor(
name=__name__,
enable_console=True, # Console output (same as original)
enable_udp=True, # UDP remote monitoring
enable_file=True, # File logging with rotation
log_dir="./logs", # Log directory
udp_host="127.0.0.1", # UDP monitoring host
udp_port=9999 # UDP monitoring port
)
# Same API as original tracecolor
logger.info("This message goes to console, file, AND UDP socket")
logger.progress("Progress messages still rate-limited, now with enterprise backend")
# Alternative: convenience function (same result)
from tracecolor import create_enhanced_logger
logger = create_enhanced_logger(__name__, enable_udp=True, enable_file=True, log_dir="logs")
# Monitor logs in real-time (separate terminal)
# tracecolor-monitor
# or: python -m tracecolor.monitor
External Configuration
Automatic Config Detection
Tracecolor automatically looks for standard config files in the current directory:
.tracecolor(auto-detects format: TOML/YAML/JSON - first priority)tracecolor.toml(TOML config)tracecolor.yml(YAML config)tracecolor.yaml(YAML alternate)tracecolor.json(JSON config)
# Just create .tracecolor in your project directory (any format)
from tracecolor import tracecolor
logger = tracecolor(__name__) # Automatically finds and parses .tracecolor
The .tracecolor file automatically detects its format, so you can use TOML, YAML, or JSON - whatever you prefer!
Manual Config File
# Create custom_config.yml
logger = tracecolor(__name__, config_file="custom_config.yml")
Config File Formats
.tracecolor supports all formats - auto-detected!
TOML format:
# TraceColor Configuration
[udp]
enabled = true
host = "127.0.0.1"
port = 9999
[console]
enabled = true
level = "TRACE"
[file]
enabled = false
dir = "./logs"
YAML:
log_level: TRACE
use_udp: true
udp_host: 127.0.0.1
udp_port: 9999
enable_console: true
enable_file: true
log_dir: "./logs"
JSON:
{
"log_level": "TRACE",
"use_udp": true,
"udp_host": "127.0.0.1",
"udp_port": 9999,
"enable_console": true,
"enable_file": true,
"log_dir": "./logs"
}
UDP Remote Monitoring
Monitor logs in real-time from any application using enhanced features:
# Terminal 1: Run your application with UDP logging
python your_app.py
# Terminal 2: Monitor logs in real-time
python -m tracecolor.monitor
# Or specify host/port
python -m tracecolor.monitor --host 0.0.0.0 --port 8888
# Legacy format also supported
python tracecolor/monitor.py listen 192.168.1.100 9999
The monitor displays formatted output with timestamps, log levels, and messages in real-time.
Migration Guide
From v0.5.0 to v0.6.0
Step 1: Update package (existing code continues to work)
uv pip install --upgrade tracecolor
Step 2: Install enhanced dependencies (optional)
uv pip install tracecolor[enhanced]
Step 3: Optionally enable enhanced features where needed
# Before (still works, now with Loguru backend!)
from tracecolor import tracecolor
logger = tracecolor(__name__) # Automatically uses Loguru if available
# Enhanced features when needed
logger = tracecolor(__name__, enable_udp=True, enable_file=True, log_dir="logs")
Step 4: Add external configuration as projects mature
# Automatic config detection (looks for tracecolor.yml, tracecolor.yaml, tracecolor.json)
logger = tracecolor(__name__) # Auto-detects config files
# Or specify custom config file
logger = tracecolor(__name__, config_file="custom_config.yml")
Color Scheme
- TRACE: Gray (bold black)
- DEBUG: Cyan
- PROGRESS: Blue
- INFO: Green
- WARNING: Yellow
- ERROR: Red
- CRITICAL: Bold Red
Examples
See the examples/ directory for comprehensive usage examples:
basic_usage.py- Original v0.5.0 functionalityenhanced_features.py- New v0.6.0 features and migration guide
License
MIT
Metadata
Release files for tracecolor 1.0.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 |
|---|---|---|---|---|
| tracecolor-1.0.0.tar.gz | 22.2 kB | Without provenance | Details for tracecolor-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tracecolor-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for tracecolor-1.0.0-py3-none-any.whl |
Total release size: 37.5 kB
Release files / tracecolor-1.0.0.tar.gz
| Download URL | tracecolor-1.0.0.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff0bf39d0bbb3ab747f89f5cb173cc5c9f21325f3fc0656d93d43047fe7b7565
|
|
BLAKE2b-256 checksum How to use checksums |
f1eb1d1e1fd7e6a72a5a53b605f39268ce7c792785e1e768e3e0151a97b7a7a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / tracecolor-1.0.0-py3-none-any.whl
| Download URL | tracecolor-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee02f01029047cfc3c6c777f00912e13126172c745a8f1defb68023af66910bf
|
|
BLAKE2b-256 checksum How to use checksums |
2e98667c3217bae1d6f35ccef3c567c9e92b319b68abc1d36b456264815b9e64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for tracecolor 1.0.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.