Skip to main content

wirelog

WireLog analytics client for Python. Zero dependencies — stdlib only.

Headless alternative to PostHog, Amplitude, and Mixpanel — designed for agents instead of dashboards.

Install

pip install wirelog

Quick Start

from wirelog import WireLog

wl = WireLog(api_key="sk_your_secret_key")

# Track an event (non-blocking, batched automatically)
wl.track("signup", user_id="u_123", event_properties={"plan": "free"})

# Query analytics (returns Markdown by default)
result = wl.query("signup | last 7d | count by day")
print(result)

# Identify a user (bind device → user, set profile)
wl.identify("alice@acme.org", device_id="dev_abc", user_properties={"plan": "pro"})

# Flush remaining events on shutdown
wl.close()

Design Principles

This client is designed to never break your application:

  • Non-blocking by default: track() buffers events and returns immediately
  • Automatic batching: Events are sent in batches (default 10 per batch, or every 2 seconds)
  • Bounded memory: Queue capped at 10,000 events — oldest events are dropped when full
  • Retry with backoff: Transient failures (429, 5xx) are retried up to 3 times
  • Graceful shutdown: close() flushes remaining events; also works as a context manager
  • Background thread: Flush worker is a daemon thread — won't block process exit

Context Manager

with WireLog(api_key="sk_...") as wl:
    wl.track("signup", user_id="u_123")
# Events are flushed automatically on exit

Configuration

wl = WireLog(
    api_key="sk_...",              # Falls back to WIRELOG_API_KEY env var
    host="https://api.wirelog.ai", # Falls back to WIRELOG_HOST env var
    timeout=30,                    # HTTP timeout in seconds
    flush_interval=2.0,            # Seconds between auto-flushes (0 = sync mode)
    batch_size=10,                 # Max events per batch
    queue_size=10000,              # Max buffered events
    on_error=lambda e: print(e),   # Background error callback
    disabled=False,                # True = track() is a no-op
)

Synchronous Mode

Set flush_interval=0 to send each track() call immediately (blocking):

wl = WireLog(api_key="sk_...", flush_interval=0)
result = wl.track("signup", user_id="u_123")  # blocks, returns {"accepted": 1}

API

wl.track(event_type, *, user_id, device_id, session_id, event_properties, user_properties, insert_id, origin, client_originated)

Track a single event. Auto-generates insert_id and time if not provided.

wl.track_batch(events, *, origin=None, client_originated=None)

Track multiple events in one request (up to 2000). Always sends immediately.

wl.query(q, *, format="llm", limit=100, offset=0)

Run a pipe DSL query. Format: "llm" (Markdown), "json", or "csv".

wl.identify(user_id, *, device_id, user_properties, user_property_ops)

Bind a device to a user and/or update profile properties.

wl.flush()

Flush all buffered events. Blocks until the queue is drained.

wl.close()

Flush remaining events and stop the background thread. Idempotent.

Zero Dependencies

This library uses only the Python standard library (urllib.request, json, threading, queue, time, uuid, os). No requests, no httpx, no urllib3. It works out of the box on any Python 3.9+ installation.

Learn More

Metadata

Release files for wirelog 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wirelog 0.3.0
File Size Uploaded
wirelog-0.3.0.tar.gz 49.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wirelog 0.3.0
File Interpreter ABI Platform
wirelog-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.3 kB

Release files / wirelog-0.3.0.tar.gz

Download URL wirelog-0.3.0.tar.gz
Size 49.5 kB
Tags Source
SHA-256 checksum
How to use checksums
96c726b5b41c5ec1f9490cc43b9c6ab8a7c8ae92f7be35f1f80f6d4875296f3a
BLAKE2b-256 checksum
How to use checksums
ac622cabfa5389476bcc0f93add7d4a9332ce239b41130a3c4bec347f7068f92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / wirelog-0.3.0-py3-none-any.whl

Download URL wirelog-0.3.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77cf066bdf05a533d236327214047816d1c27f15b4115924fea90c6ce3d6df69
BLAKE2b-256 checksum
How to use checksums
7a0a08b714b3a9142fd69b61d7ee52d5a8f29f8dfe8aebbb9bd9e7aa6a8cd2e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page