Skip to main content

Backend logging primitive for long-running async jobs

Project description

streamator

Backend logging primitive for long-running async jobs. Stream timestamped log messages to a browser UI via SSE or polling — no WebSockets, no custom infrastructure.

Pairs with streamator-react on the frontend.

Install

pip install streamator                    # core only (in-memory)
pip install streamator[fastapi]           # + FastAPI route helpers
pip install streamator[dynamo]            # + DynamoDB backend
pip install streamator[fastapi,dynamo]    # everything

Usage

from streamator import JobLogger

async def my_job(logger: JobLogger):
    logger.log("Starting…")
    await do_work()
    logger.log("Done", level="success")
    logger.close()

@router.post("/start")
async def start():
    logger = JobLogger()
    asyncio.create_task(my_job(logger))
    return {"log_job_id": logger.job_id}

Or use the context manager — close() is called automatically, even on exception:

async with JobLogger() as logger:
    logger.log("Starting…")
    await do_work()
    logger.log("Done", level="success")

FastAPI integration

from streamator.fastapi import add_log_routes

add_log_routes(app, prefix="/log")
# GET /log/{job_id}/stream  → SSE stream
# GET /log/{job_id}         → { logs: [...] } snapshot

Storage backends

Memory (default) — asyncio.Queue, SSE push, zero dependencies, single-process only.

DynamoDB — persists across restarts, readable by polling, distributed-friendly.

logger = JobLogger(store="dynamo", table="my-logs-table", ttl_days=1)

Log levels

"info" (default) · "success" · "warning" · "error"

Log entry format

{"event": "log", "message": "...", "level": "info", "t": 1.23}

t is seconds since the logger was created, computed at the moment log() is called.

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

streamator-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

streamator-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file streamator-0.1.1.tar.gz.

File metadata

  • Download URL: streamator-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for streamator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b0a3acef6b539805ef667f372f102370421e22a7a3e1027388d0051205eae040
MD5 f832ee98f8e853c9a1dc6b99e8bd341e
BLAKE2b-256 82e009f434019c644ea11323677d065f675bff86a4fbfc0900eed4efd4bd54b2

See more details on using hashes here.

File details

Details for the file streamator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: streamator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for streamator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb94fb9298582f2bea174308cb396e93921804dabf673d6531cbf9026423a3fe
MD5 a808c76c86e3e25628ed0262d1711e6f
BLAKE2b-256 aba1764c5e404b49afe695b3abe9f2edd237195df2c46e2c61ae415b686ea8ee

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