Skip to main content

Python client library for DevStream logging service

Project description

DevStream Python Client

Python client library for sending logs to DevStream logging service.

Installation

pip install devstream-client

Or install from source:

cd client
pip install -e .

Quick Start

Basic Usage

from devstream_client import DevStreamClient

# Initialize client
client = DevStreamClient(
    api_key="your-api-key",
    app_key="my-app",
    deployment_key="production",
    base_url="http://localhost:8787"  # or your production URL
)

# Send a simple log
client.log("Application started successfully")

# Send a log with tags
client.log_with_tags(
    "User logged in",
    user_id="12345",
    level="info",
    ip_address="192.168.1.1"
)

Python Logging Integration

import logging
from devstream_client import DevStreamHandler

# Create logger
logger = logging.getLogger("myapp")
logger.setLevel(logging.INFO)

# Add DevStream handler
handler = DevStreamHandler(
    api_key="your-api-key",
    app_key="my-app",
    deployment_key="production",
    base_url="http://localhost:8787"  # or your production URL
)
logger.addHandler(handler)

# Use standard Python logging
logger.info("Application started")
logger.error("Something went wrong", exc_info=True)

Django Integration

Add to your Django settings:

# settings.py

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'devstream': {
            'class': 'devstream_client.client.DevStreamHandler',
            'api_key': 'your-api-key',
            'app_key': 'my-django-app',
            'deployment_key': os.environ.get('DEPLOYMENT', 'local'),
            'base_url': 'http://localhost:8787',  # or your production URL
        },
    },
    'loggers': {
        'django': {
            'handlers': ['devstream'],
            'level': 'INFO',
        },
        'myapp': {
            'handlers': ['devstream'],
            'level': 'DEBUG',
        },
    },
}

Configuration

Client Parameters

  • api_key (required): Your DevStream API key
  • app_key (required): Application identifier
  • deployment_key (required): Deployment environment (e.g., 'local', 'dev', 'staging', 'production')
  • base_url (optional): DevStream service URL (default: http://localhost:8787)

Tags

Tags are key-value pairs that help you filter and search logs. You can add tags in two ways:

  1. As a list of dictionaries:
client.log("User action", tags=[
    {"name": "user_id", "value": "12345"},
    {"name": "action", "value": "login"}
])
  1. As keyword arguments:
client.log_with_tags(
    "User action",
    user_id="12345",
    action="login"
)

Features

  • Simple API for sending logs
  • Integration with Python's standard logging module
  • Support for custom tags
  • Automatic retry and error handling
  • Django-ready configuration

License

MIT License

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

devstream_client-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

devstream_client-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file devstream_client-0.1.0.tar.gz.

File metadata

  • Download URL: devstream_client-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for devstream_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f3c9fef320c5cd63d489c67cb93feff72d639c9c0efccd94e1f9d0b40324d1d
MD5 f6aa95c31faa92c620ef01d81a8326b3
BLAKE2b-256 02af0a13ee095c4e2754533d1da9b45339407d6e71063c07a4ef49fe98bf32cd

See more details on using hashes here.

File details

Details for the file devstream_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for devstream_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca0dc5361113fc699de632b471bd5240bdf59994c49920a3dc50617f89b2e3ac
MD5 8e2dce002c2c8188aaeb9e83bb9b0260
BLAKE2b-256 bba94de0692497e8764e19101373033578773f533268ddb207cc22f098735374

See more details on using hashes here.

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