BOT_API
BOT_API = 'https://api.telegram.org/bot'
Handler send logs to Telegram using Telegram Bot API.
How to use:
Use telegram bot API key from step 1 and channel name with '@' prefix from step 2 to create instance of TelegramBotHandler
$processors : callable[]
$formatter : ?\Monolog\Formatter\FormatterInterface
$level : int
$bubble : bool
$apiKey : string
Telegram bot access token provided by BotFather.
Create telegram bot with https://telegram.me/BotFather and use access token from it.
$channel : string
Telegram channel name.
Since to start with '@' symbol as prefix.
$parseMode : ?string
The kind of formatting that is used for the message.
See available options at https://core.telegram.org/bots/api#formatting-options or in AVAILABLE_PARSE_MODES
$disableWebPagePreview : ?bool
Disables link previews for links in the message.
$disableNotification : ?bool
Sends the message silently. Users will receive a notification with no sound.
$splitLongMessages : bool
True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages.
False - truncates a message that is too long.
$delayBetweenMessages : bool
Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests).
__construct(string $apiKey, string $channel, mixed $level = Logger::DEBUG, bool $bubble = true, string $parseMode = null, bool $disableWebPagePreview = null, bool $disableNotification = null, bool $splitLongMessages = false, bool $delayBetweenMessages = false) : mixed
string | $apiKey | Telegram bot access token provided by BotFather |
string | $channel | Telegram channel name |
mixed | $level | |
bool | $bubble | |
string | $parseMode | |
bool | $disableWebPagePreview | |
bool | $disableNotification | |
bool | $splitLongMessages | Split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages |
bool | $delayBetweenMessages | Adds delay between sending a split message according to Telegram API |