forked from GNUsocial/gnu-social
[CORE][Util][Exception] Add log context to BugFoundException
This commit is contained in:
parent
064288e33b
commit
afb7ae0f75
@ -40,11 +40,11 @@ use Throwable;
|
|||||||
|
|
||||||
class BugFoundException extends ServerException
|
class BugFoundException extends ServerException
|
||||||
{
|
{
|
||||||
public function __construct(string $log_message, string $message = '', int $code = 500, ?Throwable $previous = null)
|
public function __construct(string $log_message, array $log_context = [], string $message = '', int $code = 500, ?Throwable $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
$frame = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, limit: 2)[1];
|
$frame = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, limit: 2)[1];
|
||||||
$file = mb_substr($frame['file'], mb_strlen(INSTALLDIR) + 1);
|
$file = mb_substr($frame['file'], mb_strlen(INSTALLDIR) + 1);
|
||||||
Log::critical("{$log_message} in {$file}:{$frame['line']}");
|
Log::critical("{$log_message} in {$file}:{$frame['line']}", $log_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user