Skip to content

Commit 5bd66bd

Browse files
committed
update TelegramBotHandler, TelegramFormatter in respect of Monolog
1 parent 78705d3 commit 5bd66bd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/TelegramBotHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Monolog\Handler\AbstractProcessingHandler;
77
use Monolog\Handler\HandlerInterface;
88
use Monolog\Logger;
9+
use Monolog\LogRecord;
910

1011
class TelegramBotHandler extends AbstractProcessingHandler implements HandlerInterface
1112
{
@@ -55,7 +56,7 @@ public function __construct(string $token, string $chat_id, $level = Logger::DEB
5556
/**
5657
* @inheritDoc
5758
*/
58-
protected function write(array $record): void
59+
protected function write(LogRecord $record): void
5960
{
6061
$this->send($record['formatted']);
6162
}
@@ -66,7 +67,7 @@ protected function write(array $record): void
6667
*/
6768
protected function send(string $message, $option = []): void
6869
{
69-
try {
70+
try {
7071
if(!isset($option['verify'])){
7172
$option['verify'] = false;
7273
}

src/TelegramFormatter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Monolog\Formatter\FormatterInterface;
66
use Monolog\Formatter\LineFormatter;
7+
use Monolog\LogRecord;
78

89
/**
910
* Formats a message to output suitable for Telegram chat
@@ -62,7 +63,7 @@ public function __construct($html = true, $format = null, $dateFormat = null, $s
6263
/**
6364
* {@inheritdoc}
6465
*/
65-
public function format(array $record)
66+
public function format(LogRecord $record)
6667
{
6768
$message = '';
6869
if (isset($record['context']) && isset($record['context']['exception'])) {

0 commit comments

Comments
 (0)