Exclude classes from logging
This commit is contained in:
parent
c711208237
commit
4de03b0c11
2 changed files with 11 additions and 6 deletions
|
@ -87,7 +87,7 @@ class Introspection implements IHaveCallIntrospections
|
||||||
'line' => $trace[$i - 1]['line'] ?? null,
|
'line' => $trace[$i - 1]['line'] ?? null,
|
||||||
'function' => $trace[$i]['function'] ?? null,
|
'function' => $trace[$i]['function'] ?? null,
|
||||||
'request-id' => $this->requestId,
|
'request-id' => $this->requestId,
|
||||||
'stack' => System::callstack(10, 4),
|
'stack' => System::callstack(10, 0, true, ['Friendica\Core\Logger\Type\StreamLogger', 'Friendica\Core\Logger\Type\AbstractLogger', 'Friendica\Core\Logger\Type\WorkerLogger', 'Friendica\Core\Logger']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,9 +230,10 @@ class System
|
||||||
* @param int $offset How many calls to shave off the top of the stack, for example if
|
* @param int $offset How many calls to shave off the top of the stack, for example if
|
||||||
* this is called from a centralized method that isn't relevant to the callstack
|
* this is called from a centralized method that isn't relevant to the callstack
|
||||||
* @param bool $full If enabled, the callstack is not compacted
|
* @param bool $full If enabled, the callstack is not compacted
|
||||||
|
* @param array $exclude
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function callstack(int $depth = 4, int $offset = 0, bool $full = false): string
|
public static function callstack(int $depth = 4, int $offset = 0, bool $full = false, array $exclude = []): string
|
||||||
{
|
{
|
||||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
|
|
||||||
|
@ -247,6 +248,10 @@ class System
|
||||||
|
|
||||||
while ($func = array_pop($trace)) {
|
while ($func = array_pop($trace)) {
|
||||||
if (!empty($func['class'])) {
|
if (!empty($func['class'])) {
|
||||||
|
if (in_array($func['class'], $exclude)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$full && in_array($previous['function'], ['insert', 'fetch', 'toArray', 'exists', 'count', 'selectFirst', 'selectToArray',
|
if (!$full && in_array($previous['function'], ['insert', 'fetch', 'toArray', 'exists', 'count', 'selectFirst', 'selectToArray',
|
||||||
'select', 'update', 'delete', 'selectFirstForUser', 'selectForUser'])
|
'select', 'update', 'delete', 'selectFirstForUser', 'selectForUser'])
|
||||||
&& (substr($previous['class'], 0, 15) === 'Friendica\Model')) {
|
&& (substr($previous['class'], 0, 15) === 'Friendica\Model')) {
|
||||||
|
|
Loading…
Reference in a new issue