Improve logging
This commit is contained in:
parent
e404767a06
commit
b67d876dee
@ -1,2 +1,2 @@
|
|||||||
script:
|
script:
|
||||||
- curl https://api.rollbar.com/api/1/deploy/ -F access_token=31979a2053e045548573d29232dde9c5 -F environment=production -F revision=`git log -n 1 --pretty=format:"%H"` -F local_username=$USER
|
- curl https://api.rollbar.com/api/1/deploy/ -F access_token=f9fff6689aea4905b58eec73f66c791d -F environment=production -F revision=`git log -n 1 --pretty=format:"%H"` -F local_username=$USER
|
||||||
|
@ -32,7 +32,7 @@ class Exception extends \Exception
|
|||||||
if (strpos($message, 'Received request to switch to DC ') !== false) {
|
if (strpos($message, 'Received request to switch to DC ') !== false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
\Rollbar\Rollbar::log($this, debug_backtrace(), 'error');
|
\Rollbar\Rollbar::log(\Rollbar\Payload\Level::error(), $this, debug_backtrace(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -327,6 +327,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
|||||||
'logger_param' => '/tmp/MadelineProto.log',
|
'logger_param' => '/tmp/MadelineProto.log',
|
||||||
'logger' => 3, // overwrite previous setting and echo logs
|
'logger' => 3, // overwrite previous setting and echo logs
|
||||||
'logger_level' => Logger::VERBOSE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
|
'logger_level' => Logger::VERBOSE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
|
||||||
|
'rollbar_token' => 'f9fff6689aea4905b58eec73f66c791d'
|
||||||
],
|
],
|
||||||
'max_tries' => [
|
'max_tries' => [
|
||||||
'query' => 5, // How many times should I try to call a method or send an object before throwing an exception
|
'query' => 5, // How many times should I try to call a method or send an object before throwing an exception
|
||||||
@ -379,7 +380,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
|||||||
|
|
||||||
public function setup_logger()
|
public function setup_logger()
|
||||||
{
|
{
|
||||||
\Rollbar\Rollbar::init(['environment' => 'production', 'root' => __DIR__, 'access_token' => '31979a2053e045548573d29232dde9c5'], false, false);
|
\Rollbar\Rollbar::init(['environment' => 'production', 'root' => __DIR__, 'access_token' => isset($this->settings['logger']['rollbar_token']) ? $this->settings['logger']['rollbar_token'] : 'f9fff6689aea4905b58eec73f66c791d'], false, false);
|
||||||
\danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->authorization['user']) ? (isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id']) : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE);
|
\danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->authorization['user']) ? (isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id']) : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +530,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
|||||||
|
|
||||||
public function getV()
|
public function getV()
|
||||||
{
|
{
|
||||||
return 23;
|
return 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_self()
|
public function get_self()
|
||||||
|
@ -272,9 +272,8 @@ trait Files
|
|||||||
try {
|
try {
|
||||||
$res = $cdn ? $this->method_call('upload.getCdnFile', ['file_token' => $info['file_token'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]) : $this->method_call('upload.getFile', ['location' => $info['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]);
|
$res = $cdn ? $this->method_call('upload.getCdnFile', ['file_token' => $info['file_token'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]) : $this->method_call('upload.getFile', ['location' => $info['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]);
|
||||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||||
if ($e->getMessage() === 'OFFSET_INVALID') {
|
if ($e->rpc === 'OFFSET_INVALID') {
|
||||||
\Rollbar\Rollbar::log($info);
|
\Rollbar\Rollbar::log(\Rollbar\Payload\Level::error(), $e->rpc, ['info' => $info, 'offset' => $offset]);
|
||||||
\Rollbar\Rollbar::log($offset);
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@ -54,6 +54,7 @@ class RPCErrorException extends \Exception
|
|||||||
if (in_array($this->rpc, ['CHANNEL_PRIVATE'])) {
|
if (in_array($this->rpc, ['CHANNEL_PRIVATE'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (strpos($this->rpc, 'FLOOD_WAIT_') !== false) return;
|
||||||
$additional = [];
|
$additional = [];
|
||||||
foreach (debug_backtrace() as $level) {
|
foreach (debug_backtrace() as $level) {
|
||||||
if (isset($level['function']) && $level['function'] === 'method_call') {
|
if (isset($level['function']) && $level['function'] === 'method_call') {
|
||||||
@ -61,6 +62,6 @@ class RPCErrorException extends \Exception
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\Rollbar\Rollbar::log($this, $additional, 'error');
|
\Rollbar\Rollbar::log(\Rollbar\Payload\Level::error(), $this, $additional);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user