Handle logs with telegram bot
Simple monolog with telegram
Install the latest version with
composer require ide2/telegram-handler
<?php
require 'vendor/autoload.php';
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use TelegramHandler\TelegramHandler;
use TelegramHandler\TelegramFormatter;
// create a log channel
$token = '123456:abcdefgdkjaskldjas';
$chat_id = 123456789;
$log = new Logger('MyTestApplication');
$handler = new TelegramHandler($token, $chat_id, Logger::INFO);
$handler->setFormatter(new TelegramFormatter());
$log->pushHandler($handler);
$log->addInfo('Lorem ipsum dolor sit.', ['test', 'test test']);
$log->addError('Lorem ipsum dolor sit.');