Skip to main content

Production-grade logging SDK for VedaTrace

Project description

VedaTrace (Python SDK)

VedaTrace is a production-grade Python logging SDK for structured application logs. It provides a safe, synchronous-first API with built-in transports, batching, retry controls, and contextual child loggers.


Table of Contents


Installation

pip install vedatrace

Quickstart

from vedatrace import VedaTrace, VedaTraceConfig

config = VedaTraceConfig(
    api_key="YOUR_API_KEY",
    service="your-service",
    console_enabled=False,
)

logger = VedaTrace("YOUR_API_KEY", service="your-service", config=config)
logger.info("Service started", {"env": "production"})

Configuration

Use VedaTraceConfig to control runtime behavior.

from vedatrace import BatchingConfig, RetryConfig, VedaTrace, VedaTraceConfig


def on_error(exc: Exception) -> None:
    # Route SDK failures to your telemetry.
    pass


config = VedaTraceConfig(
    api_key="YOUR_API_KEY",
    service="your-service",
    console_enabled=False,
    batching=BatchingConfig(enabled=True, batch_size=10, flush_interval_seconds=5.0),
    retry=RetryConfig(max_retries=3, retry_delay_seconds=1.0),
    on_error=on_error,
)

logger = VedaTrace("YOUR_API_KEY", service="your-service", config=config)

Transports

Default behavior:

  • HTTP transport is enabled by default.
  • Console transport is enabled when console_enabled=True.

Custom transports:

  • If config.transports is set, only those transports are used.
from vedatrace import LogRecord, VedaTrace, VedaTraceConfig


class MemoryTransport:
    def __init__(self) -> None:
        self.batches: list[list[LogRecord]] = []

    def emit(self, records: list[LogRecord]) -> None:
        self.batches.append(list(records))

    def close(self) -> None:
        return None


transport = MemoryTransport()
config = VedaTraceConfig(
    api_key="YOUR_API_KEY",
    service="your-service",
    console_enabled=False,
    transports=[transport],
)

logger = VedaTrace("YOUR_API_KEY", service="your-service", config=config)
logger.info("Stored in custom transport")

Batching (Opt-In)

Batching is disabled by default. Enable it to queue logs and flush in groups by threshold or interval.

from vedatrace import BatchingConfig, VedaTrace, VedaTraceConfig

config = VedaTraceConfig(
    api_key="YOUR_API_KEY",
    service="your-service",
    console_enabled=False,
    batching=BatchingConfig(enabled=True, batch_size=10, flush_interval_seconds=5.0),
)

logger = VedaTrace("YOUR_API_KEY", service="your-service", config=config)
logger.info("Queued log")
logger.flush()  # Force-send pending records

Retry Policy (HTTP Only)

RetryConfig applies only to HTTP sends. Retries use a fixed delay and stop after the configured maximum attempts. If all retries fail, the final error is routed to on_error when provided.

from vedatrace import RetryConfig, VedaTrace, VedaTraceConfig

config = VedaTraceConfig(
    api_key="YOUR_API_KEY",
    service="your-service",
    console_enabled=False,
    retry=RetryConfig(max_retries=3, retry_delay_seconds=1.0),
)

logger = VedaTrace("YOUR_API_KEY", service="your-service", config=config)
logger.info("Event")

Child Loggers

from vedatrace import VedaTrace

parent = VedaTrace("YOUR_API_KEY", service="your-service")
api_logger = parent.child({"module": "api"})
api_logger.info("Request handled", {"request_id": "123"})

Metadata precedence is: parent defaults < child defaults < per-call metadata. Child loggers share engine resources; child.close() does not tear down the parent-owned engine.

Safety Guarantees

  • Public logging methods never raise (debug, info, warning, error, fatal, flush, close).
  • Internal failures are swallowed and routed to on_error(Exception) when configured.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vedatrace-0.1.1.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vedatrace-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file vedatrace-0.1.1.tar.gz.

File metadata

  • Download URL: vedatrace-0.1.1.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vedatrace-0.1.1.tar.gz
Algorithm Hash digest
SHA256 48a87ed5e8b56f7eb3fcaba30577d9b2e4cdf55ea82d20fa4befa1e793419407
MD5 47c03c09de9d06fc4ad60d3fc4ca4c6d
BLAKE2b-256 813a75ec1319c8b52bf6a92b32be3e317e77db93defb13ee065d0d7a6536ee74

See more details on using hashes here.

Provenance

The following attestation bundles were made for vedatrace-0.1.1.tar.gz:

Publisher: release.yml on neumann007/vedatrace-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vedatrace-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vedatrace-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vedatrace-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f7c08241ccb2716bb3d424218f73c6f12ab6376a77534fca0976c155babd444
MD5 2d9afb85d1e912afd996597eea6f9ef4
BLAKE2b-256 96ca598d58cde2492bbc57b6852f7e4ecd29e593eb424cf0b21dded4032a2150

See more details on using hashes here.

Provenance

The following attestation bundles were made for vedatrace-0.1.1-py3-none-any.whl:

Publisher: release.yml on neumann007/vedatrace-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page