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/
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. For such apps, public keys are on the way: https://bugsradar.com/docs/#public-keys
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
Release files for bugsradar 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bugsradar-3.0.1.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bugsradar-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.7 kB
Release files / bugsradar-3.0.1.tar.gz
| Download URL | bugsradar-3.0.1.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
634ea39de236edf5c4f8ea9cb73c19eaa36933369fcef85600ba74708c7858b9
|
|
BLAKE2b-256 checksum How to use checksums |
57091217f73d271ec9858ee35ddb391b50c2ba10dcc47b018dd23ad3eb358a79
|
| 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.1-py3-none-any.whl
| Download URL | bugsradar-3.0.1-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5da763cec2005c6734d806c6ae0509c28d7f67f3895a2ac7954c5365a75f0d7
|
|
BLAKE2b-256 checksum How to use checksums |
115450d168f0ad5de22b321ed4a6deec6eb6c7d56bda452c430236c7314204ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|