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.2.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.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vedatrace-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 9672822cf12cce2f3e377887f7afa9fdafc478f083fa1bf0331495fffb57c513
MD5 e6e9470a419acf35fbb63f2bc2fbb367
BLAKE2b-256 69e00be497a254b1c1b719138dcf0088ebec602bb92a42f8f129a70f43559890

See more details on using hashes here.

Provenance

The following attestation bundles were made for vedatrace-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: vedatrace-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42ffff5ead5f2d8f6f269735628e04f8d76f9db914f2c6b6c0781cdef5a78c28
MD5 d520e8a66428c3aac9a59d558a6ee9b8
BLAKE2b-256 4cf03cf89c1c41c0bebc9bd556c912d42ef44b73b160e18c9b5686b7f06ebd2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for vedatrace-0.1.2-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