Skip to main content

BugsRadar for Python

Errors of your Python application in Telegram, Discord or Pushover: the standard logging module, loguru, uncaught exceptions and direct calls in one package. Python 3.9 and later, no dependencies outside the standard library.

Full documentation: https://bugsradar.com/docs/python/ - logging, loguru, Django, Flask, FastAPI

You need a BugsRadar project with a channel and the project's API key: create them at https://app.bugsradar.com/.

Install

pip install bugsradar

Set it up

Once, at the start of the program:

import os
import bugsradar

bugsradar.init(
    api_key=os.environ["BUGSRADAR_KEY"],
    environment="Production",  # optional
)

The API key is secret: use it only in code that runs on your servers. Never put it in a desktop app you ship to others (PyInstaller, PySide or PyQt builds) or in a public repository: anyone can take the key out of them.

From here on, records at ERROR and above from every logger and uncaught exceptions go to BugsRadar. init adds no handlers: your logging setup works as before. Django, Flask and Uvicorn log unhandled exceptions of requests, so init covers them too.

logging

logger.exception("Order %s failed", order_id)

The format string becomes the message template, so failures of different orders are one error with a count.

loguru

loguru writes past the logging module, so init does not see it. Add the sink after your own loguru setup (logger.remove() without an id removes every sink, this one too):

from loguru import logger

bugsradar.init(api_key=os.environ["BUGSRADAR_KEY"])
logger.add(bugsradar.LoguruSink())  # ERROR and above; LoguruSink("WARNING") for more

loguru keeps only the formatted text, so the server groups messages with numbers, ids and quoted values masked. If you route logging into loguru with an InterceptHandler, those records are sent once, by init.

Direct calls

try:
    create_order(order_id)
except Exception as error:
    bugsradar.send_exception(error, module="Orders")

send and send_exception queue the event and return at once; nothing raises.

Before the program exits

init registers an atexit hook that waits up to shutdown_timeout (5 s) for queued reports. In a short script you can also wait yourself:

bugsradar.flush()

Questions: support@bistriy.com

Metadata

Release files for bugsradar 3.0.2

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

Source distribution (sdist)

Source distribution for bugsradar 3.0.2
File Size Uploaded Provenance Actions
bugsradar-3.0.2.tar.gz 15.0 kB Without provenance Details for bugsradar-3.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 34.8 kB

Release files / bugsradar-3.0.2.tar.gz

Download URL bugsradar-3.0.2.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5349ec6108e314bbef33683bcc68a9bdf2e525bb8cc73259e9c7f217350a0315
BLAKE2b-256 checksum
How to use checksums
c0e14e35de0cac896dc20aacca0b093ce0eefbc72067e11e14d2a98cf63ab0ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / bugsradar-3.0.2-py3-none-any.whl

Download URL bugsradar-3.0.2-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ce5777ffc3d14b6cc81ecc545683d4a9aa1a615be92743cc1ee8b2296a4d2b2
BLAKE2b-256 checksum
How to use checksums
39bdd71986f1f2e62dd7d324f1ad030250d1122e0a45d689fa5d21402e4d1255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for bugsradar 3.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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