Module discord_lumberjack.handlers.discord_webhook_handler

Classes

class DiscordWebhookHandler (url: str, level: int = 0, message_creator: MessageCreator = None, username: str = None, avatar_url: str = None)

A logging handler that sends messages to a Discord webhook.

The username and avatar fields will override those provided by the message creator if provided here.

Args

url : str
The URL to make the request to. This must be a webhook URL.
level : int, optional
The level at which to log. Defaults to logging.NOTSET.
message_creator : MessageCreator, optional
An instance of MessageCreator or one of its subclasses that will be used to create the message to send from each log record. Defaults to one that sends messages in monospace.
username : str, optional
The username to use when sending messages. Defaults to None.
avatar_url : str, optional
The avatar URL to use when sending messages. Defaults to None.

Initializes the instance - basically setting the formatter to None and the filter list to empty.

Ancestors

Methods

def transform_message(self, message: Dict[str, Any]) ‑> Dict[str, Any]

Replace the username and avatar fields set by the message creator (if any) with those provided to the handler (if any).

Args

message : Dict[str, Any]
The message provided by the message creator.

Returns

Dict[str, Any]
The transformed message.

Inherited members