mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 15:14:39 +01:00
Enable PHP logging
This commit is contained in:
parent
812dc89bc2
commit
79b0e647f5
@ -517,6 +517,7 @@ class MTProto implements TLCallback
|
||||
|
||||
$app_version = '4.9.1 (13613)';
|
||||
}
|
||||
$backtrace = debug_backtrace(0);
|
||||
|
||||
$this->altervista = isset($_SERVER['SERVER_ADMIN']) && strpos($_SERVER['SERVER_ADMIN'], 'altervista.org');
|
||||
// Set default settings
|
||||
@ -641,7 +642,7 @@ class MTProto implements TLCallback
|
||||
* $message is an array containing the messages the log, $level, is the logging level
|
||||
*/
|
||||
// write to
|
||||
'logger_param' => getcwd().'/MadelineProto.log',
|
||||
'logger_param' => dirname(end($backtrace)['file']).'/MadelineProto.log',
|
||||
'logger' => php_sapi_name() === 'cli' ? 3 : 2,
|
||||
// overwrite previous setting and echo logs
|
||||
'logger_level' => Logger::VERBOSE,
|
||||
|
@ -49,6 +49,15 @@ trait Loop
|
||||
set_time_limit(-1);
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
$backtrace = debug_backtrace(0);
|
||||
try {
|
||||
error_reporting(E_ALL);
|
||||
ini_set("log_errors", 1);
|
||||
ini_set("error_log", dirname(end($backtrace)['file'])."/MadelineProto.log");
|
||||
error_log('Enabled PHP logging');
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
$this->logger->logger("Could not enable PHP logging");
|
||||
}
|
||||
|
||||
$lockfile = dirname(end($backtrace)['file']).'/bot.lock';
|
||||
unset($backtrace);
|
||||
$try_locking = true;
|
||||
|
Loading…
Reference in New Issue
Block a user