Async handlers to throw logs to telegram and discord via Telegram Bot API and Discord Webhook
Note! These handlers are asynchronous, so the order of the logs is not guaranteed!
Usage:
Specify these environment variables:
TELEGRAM_CHANNEL_ID - telegram user of channel idTELEGRAM_TOKEN - token, that you can obtain from BotFatherSERVER_NAME - Machine name (useful, if you want to receive logs from different machines)DISCORD_WEBHOOK_URL - Webhook url for discord
You also can configure handlers directly
from custom_handlers.logging_handlers import DiscordHandler, TelegramHandler
import logging
from logging import Formatter
logger = logging.getLogger(__name__)
logger.setLevel("DEBUG")
handler = TelegramHandler(token="ABCD",
channel_id="1234567890",
formatter=Formatter("%(asctime)s - "))
handler.setLevel("DEBUG")
logger.addHandler(handler)
d_handler = DiscordHandler(sender_name="Again testing",
regular_message_text="regular message",
embeds_title="Embedded title",
)
d_handler.setLevel("DEBUG")
logger.addHandler(d_handler)
logger.error("Error log message")
logger.info("Info log message")
logger.debug("Debug log message")
logger.warning("Warning log message")
logger.critical("Critical log message")
Metadata
Release files for external-logging-handlers 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| external-logging-handlers-0.1.4.tar.gz | 4.6 kB | Without provenance | Details for external-logging-handlers-0.1.4.tar.gz |
Release files / external-logging-handlers-0.1.4.tar.gz
| Download URL | external-logging-handlers-0.1.4.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61011529b4d216b716d1e9b81ff1c7d0dd4bc074ea10da663ab7b4df8bcb976b
|
|
BLAKE2b-256 checksum How to use checksums |
0540926ea2d1dd4b4b6b029ae6470706ba1f9f8a9b27894ff5f9220e622eef2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Security for external-logging-handlers 0.1.4
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.