Пакет для laravel TLE - Telegram логгер ошибок
Read this in other language: English, Русский, Український
- php 7.0
- composer
Установить пакет с помощью composer
composer require jackmartin/telegram-logger-errorsПосле установки пакета с помощью composer, зарегистрируйте сервис пакета в файле config/app.php:
Telegram\Bot\Laravel\TelegramServiceProvider::class,
TLE\TLEServiceProvider::classЗатем для быстрого вызов класса пакета, добавьте псевдоним в этот же файле:
'Telegram' => Telegram\Bot\Laravel\Facades\Telegram::class,
'TLE' => TLE\Facades\TLEFacade::classphp artisan vendor:publishВыбираем Provider: Telegram\Bot\Laravel\TelegramServiceProvider
php artisan vendor:publishВыбираем Tag: tle-config
или
php artisan vendor:publish --provider="TLE\TLEServiceProvider" --tag="tle-config"'bots' => [
'common' => [
'username' => 'Name bot',
'token' => 'Token bot',
'commands' => [],
],
],
'default' => 'common','debug' => falseНужно для Telegram SDK
'botname' => '''chat_id' => '''save_log' => true'path_save' => 'local''disable_exception_telegram' => falseuse TLE;
try {
print_r($a);
} catch (\Exception $e) {
TLE::exp($e)->send();
}use TLE;
try {
print_r($a);
} catch (\Exception $e) {
TLE::exp($e)->info('Field check')->send();
}use TLE;
try {
print_r($a);
} catch (RequestException $e) {
TLE::guzzle($e)->send();
}public function report(Exception $exception)
{
\TLE::exp($exception)->send();
parent::report($exception);
}
