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
- Quickstart
- Configuration
- Transports
- Batching (Opt-In)
- Retry Policy (HTTP Only)
- Child Loggers
- Safety Guarantees
- License
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.transportsis 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9672822cf12cce2f3e377887f7afa9fdafc478f083fa1bf0331495fffb57c513
|
|
| MD5 |
e6e9470a419acf35fbb63f2bc2fbb367
|
|
| BLAKE2b-256 |
69e00be497a254b1c1b719138dcf0088ebec602bb92a42f8f129a70f43559890
|
Provenance
The following attestation bundles were made for vedatrace-0.1.2.tar.gz:
Publisher:
release.yml on neumann007/vedatrace-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vedatrace-0.1.2.tar.gz -
Subject digest:
9672822cf12cce2f3e377887f7afa9fdafc478f083fa1bf0331495fffb57c513 - Sigstore transparency entry: 992599857
- Sigstore integration time:
-
Permalink:
neumann007/vedatrace-python@9ae4950e2bf1765135751190bfefec13e9ab69c1 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/neumann007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ae4950e2bf1765135751190bfefec13e9ab69c1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42ffff5ead5f2d8f6f269735628e04f8d76f9db914f2c6b6c0781cdef5a78c28
|
|
| MD5 |
d520e8a66428c3aac9a59d558a6ee9b8
|
|
| BLAKE2b-256 |
4cf03cf89c1c41c0bebc9bd556c912d42ef44b73b160e18c9b5686b7f06ebd2c
|
Provenance
The following attestation bundles were made for vedatrace-0.1.2-py3-none-any.whl:
Publisher:
release.yml on neumann007/vedatrace-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vedatrace-0.1.2-py3-none-any.whl -
Subject digest:
42ffff5ead5f2d8f6f269735628e04f8d76f9db914f2c6b6c0781cdef5a78c28 - Sigstore transparency entry: 992599862
- Sigstore integration time:
-
Permalink:
neumann007/vedatrace-python@9ae4950e2bf1765135751190bfefec13e9ab69c1 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/neumann007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ae4950e2bf1765135751190bfefec13e9ab69c1 -
Trigger Event:
push
-
Statement type: