mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
Sending debug errors to us to Telegram bot (#1323)
* Sending debug errors to us to Telegram bot * Update Dev.php * Updated * Apply fixes from StyleCI (#1325) Co-authored-by: StyleCI Bot <bot@styleci.io> --------- Co-authored-by: Yury Pikhtarev <exileum@icloud.com> Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
parent
9b10b16460
commit
ccb001ca27
4 changed files with 108 additions and 14 deletions
|
@ -37,15 +37,15 @@
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
"ext-mysqli": "*",
|
|
||||||
"ext-mbstring": "*",
|
|
||||||
"ext-json": "*",
|
|
||||||
"ext-bcmath": "*",
|
"ext-bcmath": "*",
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-curl": "*",
|
||||||
"ext-intl": "*",
|
"ext-intl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-mysqli": "*",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"ext-xmlwriter": "*",
|
"ext-xmlwriter": "*",
|
||||||
"ext-curl": "*",
|
|
||||||
"ext-ctype": "*",
|
|
||||||
"arokettu/bencode": "^4.1.0",
|
"arokettu/bencode": "^4.1.0",
|
||||||
"bugsnag/bugsnag": "^v3.29.1",
|
"bugsnag/bugsnag": "^v3.29.1",
|
||||||
"claviska/simpleimage": "^4.0",
|
"claviska/simpleimage": "^4.0",
|
||||||
|
@ -53,6 +53,7 @@
|
||||||
"filp/whoops": "^2.15",
|
"filp/whoops": "^2.15",
|
||||||
"gigablah/sphinxphp": "2.0.8",
|
"gigablah/sphinxphp": "2.0.8",
|
||||||
"google/recaptcha": "^1.3",
|
"google/recaptcha": "^1.3",
|
||||||
|
"jacklul/monolog-telegram": "^3.1",
|
||||||
"josantonius/cookie": "^2.0",
|
"josantonius/cookie": "^2.0",
|
||||||
"longman/ip-tools": "1.2.1",
|
"longman/ip-tools": "1.2.1",
|
||||||
"monolog/monolog": "^3.4",
|
"monolog/monolog": "^3.4",
|
||||||
|
|
76
composer.lock
generated
76
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "29829118bcf2c44f41d12e79091d79e6",
|
"content-hash": "3e19fe76f513cea154195f8eb132bfa0",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "arokettu/bencode",
|
"name": "arokettu/bencode",
|
||||||
|
@ -1037,6 +1037,67 @@
|
||||||
],
|
],
|
||||||
"time": "2023-12-03T20:05:35+00:00"
|
"time": "2023-12-03T20:05:35+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "jacklul/monolog-telegram",
|
||||||
|
"version": "3.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/jacklul/monolog-telegram.git",
|
||||||
|
"reference": "ec8674fbd280bbb369b5f48447259e44a92f39c8"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/jacklul/monolog-telegram/zipball/ec8674fbd280bbb369b5f48447259e44a92f39c8",
|
||||||
|
"reference": "ec8674fbd280bbb369b5f48447259e44a92f39c8",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"monolog/monolog": "^3.0",
|
||||||
|
"php": "^8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"phpunit/phpunit": "^9.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.2",
|
||||||
|
"vlucas/phpdotenv": "^5.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-curl": "cURL generally works better and is recommended"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"jacklul\\MonologTelegramHandler\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jack'lul",
|
||||||
|
"email": "jacklulcat@gmail.com",
|
||||||
|
"homepage": "https://jacklul.github.io",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Monolog handler that sends logs through Telegram bot to any chat in HTML format",
|
||||||
|
"keywords": [
|
||||||
|
"bot",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"monolog",
|
||||||
|
"telegram"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/jacklul/monolog-telegram/issues",
|
||||||
|
"source": "https://github.com/jacklul/monolog-telegram"
|
||||||
|
},
|
||||||
|
"time": "2023-11-21T18:26:36+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "josantonius/cookie",
|
"name": "josantonius/cookie",
|
||||||
"version": "v2.0.6",
|
"version": "v2.0.6",
|
||||||
|
@ -2957,15 +3018,16 @@
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
"ext-mysqli": "*",
|
|
||||||
"ext-mbstring": "*",
|
|
||||||
"ext-json": "*",
|
|
||||||
"ext-bcmath": "*",
|
"ext-bcmath": "*",
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-curl": "*",
|
||||||
"ext-intl": "*",
|
"ext-intl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-mysqli": "*",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"ext-xmlwriter": "*",
|
"ext-xmlwriter": "*"
|
||||||
"ext-curl": "*"
|
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,12 @@ if (!defined('BB_ROOT')) {
|
||||||
|
|
||||||
// System
|
// System
|
||||||
define('APP_NAME', 'TorrentPier');
|
define('APP_NAME', 'TorrentPier');
|
||||||
|
define('DEBUG_TELEGRAM_SENDER', [
|
||||||
|
// Send bug reports to developers
|
||||||
|
// Better not turn it off! But you can turn it off anyway for privacy reasons (It's easy, just remove this constant)
|
||||||
|
'token' => '5956771201:AAFQZ4edS475VWdfdbeSuAvBnhzHnhg-hCc',
|
||||||
|
'chat_id' => 669508248
|
||||||
|
]);
|
||||||
|
|
||||||
// Path (trailing slash '/' at the end: XX_PATH - without, XX_DIR - with)
|
// Path (trailing slash '/' at the end: XX_PATH - without, XX_DIR - with)
|
||||||
define('ADMIN_DIR', BB_PATH . '/admin');
|
define('ADMIN_DIR', BB_PATH . '/admin');
|
||||||
|
|
29
src/Dev.php
29
src/Dev.php
|
@ -21,6 +21,9 @@ use Whoops\Handler\PlainTextHandler;
|
||||||
use Whoops\Handler\PrettyPageHandler;
|
use Whoops\Handler\PrettyPageHandler;
|
||||||
use Whoops\Run;
|
use Whoops\Run;
|
||||||
|
|
||||||
|
use jacklul\MonologTelegramHandler\TelegramHandler;
|
||||||
|
use jacklul\MonologTelegramHandler\TelegramFormatter;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +95,11 @@ class Dev
|
||||||
*/
|
*/
|
||||||
$loggingInConsole = new PlainTextHandler();
|
$loggingInConsole = new PlainTextHandler();
|
||||||
$loggingInConsole->loggerOnly(true);
|
$loggingInConsole->loggerOnly(true);
|
||||||
$loggingInConsole->setLogger((new Logger(APP_NAME, [(new BrowserConsoleHandler())->setFormatter((new LineFormatter(null, null, true)))])));
|
$loggingInConsole->setLogger((new Logger(
|
||||||
|
APP_NAME,
|
||||||
|
[(new BrowserConsoleHandler())
|
||||||
|
->setFormatter((new LineFormatter(null, null, true)))]
|
||||||
|
)));
|
||||||
$whoops->pushHandler($loggingInConsole);
|
$whoops->pushHandler($loggingInConsole);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,10 +108,28 @@ class Dev
|
||||||
if (ini_get('log_errors') == 1) {
|
if (ini_get('log_errors') == 1) {
|
||||||
$loggingInFile = new PlainTextHandler();
|
$loggingInFile = new PlainTextHandler();
|
||||||
$loggingInFile->loggerOnly(true);
|
$loggingInFile->loggerOnly(true);
|
||||||
$loggingInFile->setLogger((new Logger(APP_NAME, [(new StreamHandler(WHOOPS_LOG_FILE))->setFormatter((new LineFormatter(null, null, true)))])));
|
$loggingInFile->setLogger((new Logger(
|
||||||
|
APP_NAME,
|
||||||
|
[(new StreamHandler(WHOOPS_LOG_FILE))
|
||||||
|
->setFormatter((new LineFormatter(null, null, true)))]
|
||||||
|
)));
|
||||||
$whoops->pushHandler($loggingInFile);
|
$whoops->pushHandler($loggingInFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send debug to us :D
|
||||||
|
*/
|
||||||
|
if (defined('DEBUG_TELEGRAM_SENDER') && is_array(DEBUG_TELEGRAM_SENDER)) {
|
||||||
|
$telegramSender = new PlainTextHandler();
|
||||||
|
$telegramSender->loggerOnly(true);
|
||||||
|
$telegramSender->setLogger((new Logger(
|
||||||
|
APP_NAME,
|
||||||
|
[(new TelegramHandler(DEBUG_TELEGRAM_SENDER['token'], DEBUG_TELEGRAM_SENDER['chat_id']))
|
||||||
|
->setFormatter(new TelegramFormatter())]
|
||||||
|
)));
|
||||||
|
$whoops->pushHandler($telegramSender);
|
||||||
|
}
|
||||||
|
|
||||||
$whoops->register();
|
$whoops->register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue