Sends/Writes an error message to the log

@param string|array $message
@param string       $category

@return static
558693
public function error($message, $category = null)
    {
        return $this->log(self::LEVEL_ERROR, $message, $category);
    }
1017758
public function category($category)
    {
        $categoryId = NotificationCategory::getIdByCategory($category);
        $this->setNotificationData('category_id', $categoryId);

        return $this;
    }
1062531
public function warn($message, $category = null)
    {
        return $this->log(self::LEVEL_WARN, $message, $category);
    }
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;
    }
57737
public function fatal($message, $category = null)
    {
        return $this->log(self::LEVEL_FATAL, $message, $category);
    }
403543
@Override
  public void logError(
      CacheErrorCategory category,
      Class<?> clazz,
      String message,
      @Nullable Throwable throwable) {
  }
399727
public function translate($category, $message, $params, $language)
    {
        if (stripos($message, '{lang:') !== false) {
            $message = $this->removeLegacyLangTags($message);
        }

        return parent::translate($category, $message, $params, $language);
    }
1202620
public function destroy(Category $category)
    {
        if ($category->isRoot()) {
            abort(404);
        }

        if ($category->articles()->count()) {
            return $this->notifyError(trans('cms::categories.destroy.error'));
        }

        $category->delete();

        return $this->notifySuccess(trans('cms::categories.destroy.success'));
    }
164531
public function error($message, $throwable = null) {
		$this->log(\n2n\log4php\LoggerLevel::getLevelError(), $message, $throwable);
	}
536929
public static function error($message, $context = [], $channel = 'tastphp.logger')
    {
        $logger = static::getLoggerByLevelAndChannel(Monolog::ERROR, $channel);
        $logger->addError($message, $context);
    }
592455
public function withError($title = '', $message = '')
    {
        $error = new MessageBag(compact('title', 'message'));

        session()->flash('error', $error);

        return $this;
    }
506148
public function info($message, $category = null)
    {
        return $this->log(self::LEVEL_INFO, $message, $category);
    }
521711
public function emergency($message, $log_category = null, $options = array()) {
	    return static::write(AlaxosLog::$_levelMap['emergency'], $message, $log_category, $options);
	}
182904
public function add_error($message, $field = null)
    {
        $message = array_values((array)$message);

        // Save the error message
        if (isset($field)) {
            $this->_field_data[$field]['error'] = $message[0];
        }
        $this->_error_array = array_merge($this->_error_array, $message);
        return $this;
    }
1245723
protected function getMessageFilePath($category, $language)
    {
        $messageFile = $this->aliases->get($this->basePath) . "/$language/";
        if (isset($this->fileMap[$category])) {
            $messageFile .= $this->fileMap[$category];
        } else {
            $messageFile .= str_replace('\\', '/', $category) . '.php';
        }

        return $messageFile;
    }
502636
public function error($message, ReviewInterface $review, ReviewableInterface $subject)
    {
        $this->report(Issue::LEVEL_ERROR, $message, $review, $subject);

        return $this;
    }
199791
public function setCategory($category)
    {
        self::writeFullTag(
            $category,
            'category',
            true,
            'video:category',
            $this->validator,
            'validateCategory',
            $this->exception,
            'Provided category value is not a valid.'
        );

        return $this;
    }