1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 04:37:38 +02:00

Added support for working with BufferHandler (#1481)

* Added support for working with BufferHandler

Added `handleBatch` method for TelegramBotHandler and fixed `write` method.

This is necessary to work with BufferHandler, OverflowHandler etc.
This commit is contained in:
Павел Гвоздь
2020-12-10 14:51:46 +06:00
committed by GitHub
parent d284c2a35d
commit 1c9c3676e6

View File

@@ -120,6 +120,30 @@ class TelegramBotHandler extends AbstractProcessingHandler
return $this;
}
/**
* {@inheritdoc}
*/
public function handleBatch(array $records): void
{
$messages = [];
foreach ($records as $record) {
if (!$this->isHandling($record)) {
continue;
}
if ($this->processors) {
$record = $this->processRecord($record);
}
$messages[] = $record;
}
if (!empty($messages)) {
$this->send((string) $this->getFormatter()->formatBatch($messages));
}
}
/**
* @inheritDoc
*/