Log les problèmes liés aux actions différées
@param \Exception $e
@param string $category
@param string $dump
@return $this
161033
protected function registerException(\Exception $e, string $category, string $dump = null)
    {
        $this->error($e->getMessage());
        $file = sys_get_temp_dir() . '/sma-deferred-' . $category . '-errors.log';
        $data = print_r($e, true) . "\n\n" . ($dump ? $dump . "\n\n" : '');
        file_put_contents($file, $data, FILE_APPEND);
        return $this;
    }
814512
protected function handleError(Exception $e)
    {
        if($this->isCli){
            $errorCode = $e->getCode();
            exit((empty($errorCode)) ? 1 : $errorCode);	//exit the program with an error
        }
        else {
            throw new Exception($e->getMessage());
        }
    }
816918
private function logException(\Exception $e)
    {
        if (isset($this->logger)) {
            $this->logger->notice(
                $e->getMessage(), [
                                    'code' => $e->getCode(),
                                    'line' => $e->getLine(),
                                    'file' => $e->getFile(),
                                ]
            );
        } else {
            // @codeCoverageIgnoreStart
            error_log(sprintf('[%s] [%s:%d] %s', $e->getCode(), $e->getFile(), $e->getLine(), $e->getMessage()), E_NOTICE);
            // @codeCoverageIgnoreEnd
        }
    }
859214
private function log(\Exception $e = null) {dfc($this, function(\Exception $e = null) {
		/**
		 * 2017-03-30
		 * Намеренно не используем здесь не @see m(), потому что этот метод работает через @see op(),
		 * а этот метод может падать: например, если транзакция не найдена.
		 */
		$m = $this->_f->m(); /** @var M $m */
		$title = dfpm_title($m); /** @var string $title */
		/** @var \Exception|string $v */ /** @var string|null $suffix */
		if ($e) {
			list($v, $suffix) = [$e, 'exception'];
			df_log_e($e);
		}
		else {
			$ev = $this->_e; /** @var Event $ev */
			$v = df_ccc(': ', "[{$title}] {$ev->tl()}", $ev->statusT());
			$suffix = is_null($t = $ev->t()) ? null : df_fs_name($t); /** @var string|null $t $suffix */
		}
		df_sentry_m($m)->user_context(['id' => $title]);
		dfp_sentry_tags($m);
		df_sentry($m, $v, ['extra' => ($data = $this->r())]); /** @var string $data */
		df_log_l($m, $data, $suffix);
	}, [$e]);}
51082
public function report( Exception $e )
	{
		if ( !$this->shouldReport( $e ) )
			return;

		try
		{
			$logger = Framework::log();
		}
		catch ( Exception $ex )
		{
			throw $e; // throw the original Exception
		}

		$logger->error( $e );


		$level = $this->getLevel( $e );
		$id = UniversalBuilder::resolveClass( ExceptionIdentifier::class )->identify( $e );

		$logger->{$level}( $e, ['identification' => ['id' => $id]] );
	}
506024
public static function exception_handler(\Exception $e)
	{
		if (method_exists($e, 'handle'))
		{
			return $e->handle();
		}

		$severity = ( ! isset(static::$levels[$e->getCode()])) ? $e->getCode() : static::$levels[$e->getCode()];
		logger(\Fuel::L_ERROR, $severity.' - '.$e->getMessage().' in '.$e->getFile().' on line '.$e->getLine());

		if (\Fuel::$env != \Fuel::PRODUCTION)
		{
			static::show_php_error($e);
		}
		else
		{
			static::show_production_error($e);
		}
	}
943507
public function addEx(\Psc\Exception $e) {
    if (isset($e->errorMessage)) {
      $msg = $e->errorMessage;
    } else {
      $msg = $e->getMessage();
    }
    
    if (isset($e->errorStatus)) {
      $errorStatus = $e->errorStatus;
    } else {
      $errorStatus = self::ERROR;
    }
    
    $devInfo = NULL;
    if (PSC::getProject()->isDevelopment()) {
      $devInfo = \Psc\Exception::getExceptionText($e, 'html');
    }
    
    return $this->add($msg, $errorStatus, $devInfo);
  }
14779
public function renderException($e, $output = null)
    {
        if ( ! $output) {
            $output = $this->output;

            if ($output instanceof ConsoleOutputInterface) {
                $output = $output->getErrorOutput();
            }
        }

        return parent::renderException($e, $output);
    }
429358
public function logException(\Exception $e)
    {
        $error = $e->getMessage() . $e->getTraceAsString();
        return $this->logEmergency($error);
    }
751844
public function log($level, $message, $category = null)
    {
        if ($level > $this->_level) {
            return $this;
        }

        if ($category !== null && !is_string($category)) {
            $message = [$message . ': :param', 'param' => $category];
            $category = null;
        }

        if (is_array($message) && count($message) === 1 && isset($message[0])) {
            $message = $message[0];
        }

        $request_id = empty($_SERVER['DOCUMENT_ROOT']) ? '' : $this->request->getServer('HTTP_X_REQUEST_ID');

        $log = new Log();

        $log->host = gethostname();
        $log->client_ip = empty($_SERVER['DOCUMENT_ROOT']) ? '' : $this->request->getClientIp();
        $log->level = self::$_levels[$level];
        $log->request_id = $request_id ? preg_replace('#[^a-zA-Z\d-_\.]#', 'X', $request_id) : '';

        if ($message instanceof \Exception) {
            $log->category = $category ?: 'exception';
            $log->file = basename($message->getFile());
            $log->line = $message->getLine();
        } else {
            if (MANAPHP_COROUTINE) {
                /** @noinspection PhpUndefinedMethodInspection */
                $traces = \Swoole\Coroutine::getBackTrace(0, DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 7);
            } else {
                $traces = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 7);
            }
            /** @noinspection NestedTernaryOperatorInspection */
            $log->category = $category ?: $this->_inferCategory($traces);
            $location = $this->_getLocation($traces);
            if (isset($location['file'])) {
                $log->file = basename($location['file']);
                $log->line = $location['line'];
            } else {
                $log->file = '';
                $log->line = 0;
            }
        }

        $log->message = is_string($message) ? $message : $this->formatMessage($message);
        $log->timestamp = microtime(true);

        $this->eventsManager->fireEvent('logger:log', $this, $log);

        /**
         * @var \ManaPHP\Logger\AppenderInterface $appender
         */
        foreach ($this->_appenders as $name => $value) {
            if (is_object($value)) {
                $appender = $value;
            } elseif (is_string($value)) {
                $appender = $this->getAppender($name);
            } elseif (is_array($value)) {
                if (isset($value['level']) && $level > $value['level']) {
                    continue;
                }
                $appender = isset($value['instance']) ? $value['instance'] : $this->getAppender($name);
            } else {
                throw new MisuseException('');
            }

            $appender->append($log);
        }

        return $this;
    }
737887
public function renderForConsole($output, Exception $e)
    {
        if ($this->exceptionHandler !== null) {
            $this->exceptionHandler->renderForConsole($output, $e);
        }
    }
885913
private function log(Exception $e)
    {
        $dontLog = [
//            AuthenticationException::class,
//            AuthorizationException::class,
            HttpException::class,
            StopException::class,
//            TokenMismatchException::class,
//            ValidationException::class,
        ];

        foreach ($dontLog as $type) {
            if ($e instanceof $type) {
                return;
            }
        }

        $data = $this->convertException($e);
        $class = get_class($e);
        $file  = $this->stripFile($data['file']);
        $line  = $data['line'];
        $code  = $data['code'];

        // set the error message
        if ($e instanceof QueryException) {
            $message = $data['message'] . '; sql: ' . $data['sql'];
        }
        else {
            $message = $data['message'];
        }

        logger()->error($class . ' in "' . $file . '", line ' . $line . ': ' . $message . ' (code ' . $code . ')');
    }
1321940
public function category(Category $category)
    {
        $this->_category = $category;

        $this->joinWith('categories');
        $this->andFilterWhere([$category::tableName().'.id' => $this->_category->id]);

        return $this;
    }
1062531
public function warn($message, $category = null)
    {
        return $this->log(self::LEVEL_WARN, $message, $category);
    }
618157
public static function log(\Exception $e)
    {
        if (config('geoip.log-failures.enabled', false)) {
            $path = config('geoip.log-failures.path', storage_path('logs/geoip.log'));

            $log = new Logger('geoip');
            $log->pushHandler(new StreamHandler($path, Logger::ERROR));
            $log->addError($e);
        }
    }
1313031
public function debug( $object , $category , $message )
	{
		return $this->message( self::getMessagePrefix( $object , $category , 'debug' ) . $message , self::LEVEL_DEBUG );
	}
57737
public function fatal($message, $category = null)
    {
        return $this->log(self::LEVEL_FATAL, $message, $category);
    }