Vibex Python SDK - Fail-safe logging handler for vibex.sh
Project description
Vibex Python SDK
Fail-safe logging handler for sending logs to vibex.sh.
Features
- Fail-Safe: Silently disables if configuration is missing or invalid
- Kill Switch: Permanently disables on 401/403 errors (expired/invalid tokens)
- Easy Integration: Drop-in Python logging handler
- Zero Dependencies (except
requests)
Installation
pip install vibex-sh
Quick Start
- Set environment variables:
export VIBEX_TOKEN=vb_live_your_token_here
export VIBEX_SESSION_ID=my-production-app
- Use in your Python application:
import logging
from vibex_sh import VibexHandler
# Get your logger
logger = logging.getLogger('my_app')
# Add Vibex handler
vibex_handler = VibexHandler()
logger.addHandler(vibex_handler)
# Use normally
logger.info('Application started')
logger.warning('High memory usage', extra={'memory': 85})
logger.error('Failed to connect', exc_info=True)
Configuration
The SDK reads configuration from environment variables:
VIBEX_TOKEN(required): Your Vibex API tokenVIBEX_SESSION_ID(required): Your session IDVIBEX_API_URL(optional): API endpoint (default:https://vibex.sh/api/v1/ingest)
Fail-Safe Behavior
The SDK is designed to be fail-safe:
- Missing Config: If
VIBEX_TOKENorVIBEX_SESSION_IDis missing, the handler silently disables itself - Invalid Token: On 401/403 responses, the handler permanently disables for the process lifetime
- Network Errors: All network errors are silently handled - your application continues normally
- Rate Limits: On 429 (rate limit), logs are dropped but the handler remains enabled
Advanced Usage
Direct Client Usage
from vibex_sh import VibexClient, VibexConfig
config = VibexConfig()
client = VibexClient(config)
# Send custom log
client.send_log('json', {'cpu': 45, 'memory': 78})
Check if Enabled
handler = VibexHandler()
if handler.is_enabled():
logger.info('Vibex is active')
else:
logger.info('Vibex is disabled (missing config or expired token)')
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
vibex_sh-0.1.0.tar.gz
(4.5 kB
view details)
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 vibex_sh-0.1.0.tar.gz.
File metadata
- Download URL: vibex_sh-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03b2cb36717edfb4daf1df6530172f9ceb62799e1480d7f7e9b6ec81e1a93c05
|
|
| MD5 |
de743db927ad6ba0a06f5d0bd72cca90
|
|
| BLAKE2b-256 |
e58fd6c2cb5c969bf90a270968fd60bedd4c5c2619bc0f97b02af5c7752ae335
|
File details
Details for the file vibex_sh-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vibex_sh-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f05c3cf91bf8b83c5889c7862737d5ed55965046a97f69bc7659f506b8e70e1d
|
|
| MD5 |
66cb62ba91923ed1703c3ecdbfd067e8
|
|
| BLAKE2b-256 |
4ffa1246e4f7a824a8deb4712ecfd7f39016da00e1555e1b62e1351d69697aec
|