public static function log( \Throwable $throwable, LoggerInterface $instance, array $context = [] ): \Throwable {

    // extend data
    $context                = Collection::cast( $context, [] );
    $context[ 'exception' ] = $throwable;
    $context[ 'backtrace' ] = false;

    $severity  = $throwable instanceof Helper\ThrowableInterface ? $throwable->getSeverity() : Application::SEVERITY_CRITICAL;
    $namespace = get_class( $throwable ) . ':' . ( $throwable instanceof Helper\ThrowableInterface ? $throwable->getId() : $throwable->getCode() );
    $instance->create( $throwable->getMessage(), $context, $namespace, $severity );

    return $throwable;
  }
public static function log( \Throwable $throwable, LoggerInterface $instance, array $context = [] ): \Throwable {

    // extend data
    $context                = Collection::cast( $context, [] );
    $context[ 'exception' ] = $throwable;
    $context[ 'backtrace' ] = false;

    $severity  = $throwable instanceof Helper\ThrowableInterface ? $throwable->getSeverity() : Application::SEVERITY_CRITICAL;
    $namespace = get_class( $throwable ) . ':' . ( $throwable instanceof Helper\ThrowableInterface ? $throwable->getId() : $throwable->getCode() );
    $instance->create( $throwable->getMessage(), $context, $namespace, $severity );

    return $throwable;
  }
public static function log ( \ Throwable $ throwable , LoggerInterface $ instance , array $ context = [ ] ) : \ Throwable { // extend data $ context = Collection :: cast ( $ context , [ ] ) ; $ context [ 'exception' ] = $ throwable ; $ context [ 'backtrace' ] = false ; $ severity = $ throwable instanceof Helper \ ThrowableInterface ? $ throwable -> getSeverity ( ) : Application :: SEVERITY_CRITICAL ; $ namespace = get_class ( $ throwable ) . ':' . ( $ throwable instanceof Helper \ ThrowableInterface ? $ throwable -> getId ( ) : $ throwable -> getCode ( ) ) ; $ instance -> create ( $ throwable -> getMessage ( ) , $ context , $ namespace , $ severity ) ; return $ throwable ; }
Logger the `\Throwable` with the proper severity and message

@param \Throwable      $throwable
@param LoggerInterface $instance
@param array           $context

@return \Throwable The input `\Throwable`
Logger the \ Throwable with the proper severity and message