diff --git a/src/Log.php b/src/Log.php index 6793316..accb968 100644 --- a/src/Log.php +++ b/src/Log.php @@ -302,15 +302,16 @@ class Log { * @param Throwable $exception * @param string|null $prefix The prefix of the log message * (optional, default: "An exception occured") + * @param array $extra_args Extra arguments to use to compute prefix using sprintf * @return void */ - public static function exception($exception, $prefix=null) { + public static function exception($exception, $prefix=null, ...$extra_args) { SentryIntegration :: log($exception); - // If more than 2 arguments passed, format prefix message using sprintf - if ($prefix && func_num_args() > 2) { + // If extra arguments passed, format prefix message using sprintf + if ($prefix && $extra_args) { $prefix = call_user_func_array( 'sprintf', - array_merge(array($prefix), array_slice(func_get_args(), 2)) + array_merge(array($prefix), $extra_args) ); } self :: error(