Skip to main content
tailcove: Tailcove for Python

Documentation Get started free Report a bug

PyPI version Python versions PyPI downloads MIT license


Send Python logs to Tailcove with the standard logging module.


🐍  Plain logging

TailcoveHandler is a normal logging.Handler. Keep the loggers you have.

🧵  Never blocks

Records are batched and sent from a background thread, so nothing waits on the network.

📦  No dependencies

Delivery uses urllib from the standard library.

🛡️  Safe

A failed delivery is caught and never raised into your code.

🧩  Structured exceptions

Class, message, location and trace arrive as data, so identical errors group together.

🌐  Django & Flask

Copy-paste setup for both, below.

Install

pip install tailcove

Requires Python 3.9 or newer.

Quick start

1. Get a token. Create a source in your Tailcove dashboard and copy its ingest token. It is shown only once, so save it somewhere safe (an environment variable is ideal).

2. Add the handler.

import logging
import os

from tailcove import TailcoveHandler

logger = logging.getLogger("myapp")
logger.addHandler(TailcoveHandler(token=os.environ["TAILCOVE_TOKEN"]))
logger.setLevel(logging.INFO)

logger.info("user signed up", extra={"user_id": 42})
logger.error("payment failed", extra={"order_id": 99, "reason": "card_declined"})

3. Open Tailcove. Your records appear in search and live tail within a couple of seconds.

Buffered records are flushed when your program exits normally, because Python's own logging.shutdown() closes every handler.

Options

Argument Default What it does
token — Your source's ingest token. Required.
endpoint https://ingest.tailcove.dev/api/v1/logs The ingest URL. Only change this if you self-host.
batch_size 50 Send once this many records are buffered.
batch_seconds 2.0 Send once this many seconds have passed since the first buffered record.
timeout 2.0 Seconds a delivery attempt may take before giving up.
trace_limit 10 Most stack frames kept when a logged exception is rendered.
level logging.NOTSET Lowest level this handler processes, on top of the logger's own level.

Records are sent once batch_size is reached or batch_seconds has passed, whichever comes first. They are never sent one HTTP request per log call. To send whatever is buffered right now, call handler.flush(). It blocks until the background thread confirms.

Structured context

Anything you pass in extra={...} is shipped as the line's context, with the same keys:

logger.info("order placed", extra={"order_id": 99, "total_cents": 4200})

Exceptions

Log with exc_info=True, or use logger.exception(...) inside an except block, and the exception is sent as structured data and not as a flattened string:

try:
    charge_card(order)
except CardDeclined:
    logger.error("payment failed", exc_info=True)
"exception": {
    "class": "billing.errors.CardDeclined",
    "message": "insufficient funds",
    "location": "/app/billing/charge.py:42",
    "trace": [
        "/app/billing/charge.py:42 in charge_card",
        "/app/orders/service.py:17 in place_order"
    ]
}

location is where the exception was raised, and trace is limited to trace_limit frames. It's the same shape the Laravel, Node and browser libraries use, so the same error groups into one issue whichever app reported it.

Frameworks

Django

Add the handler to LOGGING in settings.py:

LOGGING = {
    "version": 1,
    "disable_existing_loggers": False,
    "handlers": {
        "tailcove": {
            "class": "tailcove.TailcoveHandler",
            "token": env("TAILCOVE_TOKEN"),
        },
    },
    "root": {
        "handlers": ["console", "tailcove"],
        "level": "INFO",
    },
    "loggers": {
        "django.request": {
            "handlers": ["tailcove"],
            "level": "ERROR",
            "propagate": True,
        },
    },
}

Flask

Attach the handler to the app logger, or to the root logger if you want every logging.getLogger(__name__) in the app to ship too:

from flask import Flask
from tailcove import TailcoveHandler

app = Flask(__name__)
app.logger.addHandler(TailcoveHandler(token=app.config["TAILCOVE_TOKEN"]))
app.logger.setLevel("INFO")


@app.errorhandler(Exception)
def handle_exception(exc):
    app.logger.error("unhandled exception", exc_info=exc)
    raise

When delivery fails

Network errors and non-2xx responses never raise into your code. emit() follows the standard Handler convention and routes its own failures through handleError(). Errors on the background thread are caught and printed to stderr. Logging is best-effort by design.

Help and feedback

Other Tailcove libraries

Laravel · Node.js · Browser

License

MIT © AKCybex


Built by AKCybex  ·  tailcove.dev

Metadata

Release files for tailcove 0.1.1

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

Source distribution (sdist)

Source distribution for tailcove 0.1.1
File Size Uploaded Provenance
tailcove-0.1.1.tar.gz 13.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 24.2 kB

Release files / tailcove-0.1.1.tar.gz

Download URL tailcove-0.1.1.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3f26f03d7a9f1da74f77275b3f3bc8ca5a680cf948b88ddf7a7993a65004c540
BLAKE2b-256 checksum
How to use checksums
f8d7e051b92fade84eaa0312003f329437b5ae6c2fe7c7e90cd5ec1dcc189410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / tailcove-0.1.1-py3-none-any.whl

Download URL tailcove-0.1.1-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebba8e8d6ec7ac69a11e2ce8595aa3757fc749e74ce0419933d64784bb0b6d86
BLAKE2b-256 checksum
How to use checksums
8396da6a2616ae668d49f7ec669f8d522b1985e606633723a6296c1270ae09d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for tailcove 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tailcove-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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