Production-grade logging SDK for VedaTrace
Project description
VedaTrace Python SDK
Production-grade logging SDK for VedaTrace (Python 3.10+).
Table of Contents
- Features
- Stability
- Installation
- Quickstart
- Configuration
- Transports
- Batching (Opt-in)
- Retry (HTTP only)
- Child Loggers
- Error Handling & Safety
- Resource Management (flush/close)
- API Reference
- Release Process (Maintainers)
- License
Features
- Log levels aligned to parity:
debug,info,warning,error,fatal - Structured log records with UTC ISO-8601 timestamps
- Default transports: Console (optional) + HTTP ingest
- Custom transport support via
config.transports - Opt-in batching with threshold + interval flush
- HTTP-only fixed-delay retries
- Child loggers with metadata precedence support
- Safe public API: logger methods do not raise user-facing exceptions
Stability
Version 0.1.0 introduces a stable public API for:
- Logger
- Config
- Transports
- Batching
- Retry
- Child loggers
Breaking changes may still occur before 1.0.
Installation
python -m pip install vedatrace
For local development:
python -m pip install -e .
Quickstart
from vedatrace import VedaTrace
logger = VedaTrace(api_key="YOUR_API_KEY", service="my-service")
logger.info("hello from vedatrace")
Configuration
from vedatrace import BatchingConfig, RetryConfig, VedaTrace, VedaTraceConfig
config = VedaTraceConfig(
api_key="YOUR_API_KEY",
service="my-service",
console_enabled=True,
batching=BatchingConfig(enabled=False, batch_size=10, flush_interval_seconds=5.0),
retry=RetryConfig(max_retries=0, retry_delay_seconds=0.0),
)
logger = VedaTrace(api_key="YOUR_API_KEY", service="my-service", config=config)
Transports
Default behavior:
- Console transport is enabled when
config.console_enabledisTrue - HTTP transport is enabled by default
Custom transports:
- Provide
config.transportsto fully override default transport creation
Batching (Opt-in)
Batching is disabled by default and must be enabled in BatchingConfig.
from vedatrace import BatchingConfig, VedaTrace, VedaTraceConfig
config = VedaTraceConfig(
api_key="YOUR_API_KEY",
service="my-service",
batching=BatchingConfig(enabled=True, batch_size=10, flush_interval_seconds=5.0),
)
logger = VedaTrace(api_key="YOUR_API_KEY", service="my-service", config=config)
logger.info("batched log")
logger.flush()
Retry (HTTP only)
Retries are fixed-delay and apply only to the default HTTP transport.
from vedatrace import RetryConfig, VedaTrace, VedaTraceConfig
config = VedaTraceConfig(
api_key="YOUR_API_KEY",
service="my-service",
retry=RetryConfig(max_retries=3, retry_delay_seconds=1.0),
console_enabled=False,
)
logger = VedaTrace(api_key="YOUR_API_KEY", service="my-service", config=config)
If retries are exhausted, on_error receives the final failure.
Child Loggers
from vedatrace import VedaTrace
parent = VedaTrace(api_key="YOUR_API_KEY", service="my-service")
api_logger = parent.child({"module": "api"})
api_logger.info("request handled", {"request_id": "123"})
Metadata precedence:
- parent defaults < child defaults < per-call metadata
child.close() does not tear down shared engine resources.
Error Handling & Safety
- Public logger methods are non-throwing (
debug/info/warning/error/fatal/flush/close) - Internal failures are routed to
on_error(Exception)when configured - SDK avoids exposing API keys in logs/errors
Resource Management (flush/close)
flush()forces pending batches to be sentclose()flushes and then closes owned resources- Child loggers share engine resources; parent logger owns teardown
API Reference
Factory:
VedaTrace(api_key: str, service: str, *, config: VedaTraceConfig | None = None) -> Logger
Logger:
debug(message: str, metadata: Metadata | None = None) -> Noneinfo(message: str, metadata: Metadata | None = None) -> Nonewarning(message: str, metadata: Metadata | None = None) -> Noneerror(message: str, metadata: Metadata | None = None) -> Nonefatal(message: str, metadata: Metadata | None = None) -> Nonechild(default_metadata: Metadata | None = None, *, service: str | None = None) -> Loggerflush() -> Noneclose() -> None
Config classes:
VedaTraceConfig(api_key, service, console_enabled=True, batching=BatchingConfig(...), retry=RetryConfig(...), transports=None, on_error=None)BatchingConfig(enabled=False, batch_size=10, flush_interval_seconds=5.0)RetryConfig(max_retries=0, retry_delay_seconds=0.0)
Transport types:
Transportprotocol:emit(records: list[LogRecord]) -> Noneclose() -> None
- Included transports:
ConsoleTransportHttpTransport
Behavior notes:
- Public log methods never raise.
- Internal failures route to
on_error(Exception)when configured. - Batching is opt-in.
- Retry applies to HTTP transport only.
child.close()does not tear down the shared engine.
Release Process (Maintainers)
- Bump version in:
src/vedatrace/__init__.pypyproject.tomlCHANGELOG.md
- Run:
python -m unittest -vpython -m compileall src
- Build:
python -m build
- Validate:
twine check dist/*
- Publish (when ready):
python -m pip install twinetwine upload dist/*
Notes:
- Never force push release commits.
- Tag releases using:
git tag v0.1.0git push origin v0.1.0
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.0.tar.gz.
File metadata
- Download URL: vedatrace-0.1.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d669e7a35340c1d0829b5a012d6b57eb6d3d739e05c61d736dcb0e0d1a3204
|
|
| MD5 |
baed9c2da4c6d090bbb729ea7d79e789
|
|
| BLAKE2b-256 |
e7f9256ced6ba534bcce8befde484d6e6c166ec376d7bacfc0241f0fd248e2b9
|
Provenance
The following attestation bundles were made for vedatrace-0.1.0.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.0.tar.gz -
Subject digest:
12d669e7a35340c1d0829b5a012d6b57eb6d3d739e05c61d736dcb0e0d1a3204 - Sigstore transparency entry: 983071108
- Sigstore integration time:
-
Permalink:
neumann007/vedatrace-python@8cf44fca670bd70c100ff12a38fd3d90efc9b36b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/neumann007
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8cf44fca670bd70c100ff12a38fd3d90efc9b36b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vedatrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vedatrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.7 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 |
fcc0d89cef53976f60747bf25a285479bd048330e4fdc021be3c7d68ad06dcc4
|
|
| MD5 |
db7bffba22eb9969bf3c11489a1f9f81
|
|
| BLAKE2b-256 |
02213d04be055130bea47366aaaf04e14338a9995b4efdcd945d1df4c199a1d4
|
Provenance
The following attestation bundles were made for vedatrace-0.1.0-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.0-py3-none-any.whl -
Subject digest:
fcc0d89cef53976f60747bf25a285479bd048330e4fdc021be3c7d68ad06dcc4 - Sigstore transparency entry: 983071143
- Sigstore integration time:
-
Permalink:
neumann007/vedatrace-python@8cf44fca670bd70c100ff12a38fd3d90efc9b36b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/neumann007
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8cf44fca670bd70c100ff12a38fd3d90efc9b36b -
Trigger Event:
workflow_dispatch
-
Statement type: