[CORE][Util][Exception] Add log context to BugFoundException

This commit is contained in:
Diogo Peralta Cordeiro 2022-01-02 20:39:49 +00:00
parent 064288e33b
commit afb7ae0f75
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0

View File

@ -40,11 +40,11 @@ use Throwable;
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);
$frame = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, limit: 2)[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);
}
}