Skip to main content

Colored Context Logger (vibe-colored-logger)

A generic, easy-to-use logging library designed for modern Python applications. It enhances standard logging with colored console output, automatic context injection, and simplified file handler management.

Installation

pip install vibe-colored-logger

Features

  • Colored Console Output: Integrated with coloredlogs for readable, severity-based coloring.
  • Global Context Injection: Automatically inject context (e.g., session_id, user_id, environment) into every log record. Great for tracking requests across functions.
  • Simplified File Logging: One-line command to attach file handlers, with support for dynamic filenames based on context.
  • Function Tracing: @log_calls decorator to automatically log function entry, exit, arguments, return values, and execution time.

Usage Guide

1. Basic Setup & Context

Initialize the logger and set global context variables that will appear in all log entries.

from vibe_logger import setup_logger, GlobalLogContext

# 1. Setup Logger (Standard Python logging wrapper)
logger = setup_logger(name="PaymentService", level="DEBUG")

# 2. Set Global Context
# These key-values will be appended to every log message automatically.
GlobalLogContext.update({
    "env": "production",
    "version": "v1.2.0",
    "request_id": "req_8848"
})

logger.info("Service initialized")
# Output: [INFO] ... env=production version=v1.2.0 request_id=req_8848 Service initialized

2. File Logging

Easily attach file handlers. You can specify a fixed filename or let the logger generate one based on the context (e.g., a specific session ID).

from vibe_logger import attach_file_handler

# Method A: Attach to a specific directory
# Filename will be auto-generated or based on 'session' context if present.
log_path = attach_file_handler(
    logger_name="PaymentService",
    log_dir="logs/payments",
    level="DEBUG"
)
print(f"Logging to: {log_path}")

# Method B: Specify exact filename
attach_file_handler(
    logger_name="PaymentService",
    log_dir="logs",
    filename="errors.log",
    level="ERROR" # Only log errors here
)

3. Function Tracing (@log_calls)

Use the @log_calls decorator to debug function execution without writing boilerplate print statements.

from vibe_logger import log_calls

@log_calls(level="DEBUG")
def process_payment(amount, currency):
    if amount <= 0:
        raise ValueError("Invalid amount")
    return f"Processed {amount} {currency}"

# Calling the function will log:
# ➡️ process_payment Start (100, 'USD')
# ⬅️ process_payment End 0.002s Ret: 'Processed 100 USD'

4. Integration with Existing Loggers

If you have an existing logging configuration, you can use GlobalLogContext to inject data into it, provided you format your logs to include the context fields. vibe-colored-logger handles the formatting automatically when using setup_logger.

Metadata

Release files for vibe-colored-logger 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vibe-colored-logger 0.1.7
File Size Uploaded Provenance Actions
vibe_colored_logger-0.1.7.tar.gz 6.1 kB With provenance Details for vibe_colored_logger-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vibe-colored-logger 0.1.7
File Interpreter ABI Platform Actions
vibe_colored_logger-0.1.7-py3-none-any.whl Python 3 none any Details for vibe_colored_logger-0.1.7-py3-none-any.whl

Total release size: 11.4 kB

Release files / vibe_colored_logger-0.1.7.tar.gz

Download URL vibe_colored_logger-0.1.7.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d12b7a4d96e2df50546888a268a6f98598c47dec059726cf56e9e8ced3e09206
BLAKE2b-256 checksum
How to use checksums
715255fd22fe729007240cc0325d824a904c06bf75ef732f96b1b56a61aa7549
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 Jan 20, 2026.

Transparency log

Release files / vibe_colored_logger-0.1.7-py3-none-any.whl

Download URL vibe_colored_logger-0.1.7-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bb47358ac45478f8dbd93cc8900915eef827c23fbb8ba41d23ddc0aeda5c5d0
BLAKE2b-256 checksum
How to use checksums
a5cc4d2a771f5186b82553f39b339f0989eafd70d77c8fd544c9cc17f63ffa81
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 Jan 20, 2026.

Transparency log

Security for vibe-colored-logger 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vibe_colored_logger-0.1.7.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 Jan 20, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page