Log the error message

@return void
541466
public function log(): void
    {
        if (file_exists(FLOW_PATH_DATA . 'Logs/Elasticsearch') && is_dir(FLOW_PATH_DATA . 'Logs/Elasticsearch') && is_writable(FLOW_PATH_DATA . 'Logs/Elasticsearch')) {
            file_put_contents($this->filename, $this->renderErrors());
            $this->logger->log($this->message, LOG_ERR, [], 'Flowpack.ElasticSearch.ContentRepositoryAdaptor', __CLASS__, __FUNCTION__);
        } else {
            $this->logger->log(sprintf('Could not write indexing errors backtrace into %s because the directory could not be created or is not writable.', FLOW_PATH_DATA . 'Logs/Elasticsearch/'), LOG_WARNING, [], 'Flowpack.ElasticSearch.ContentRepositoryAdaptor', __CLASS__, __FUNCTION__);
        }
    }
279599
public function error($e): void
  {
    $this->has_error = true;
    self::has_error();
    $msg = [
      self::$line,
      self::get_log_line('ERROR DB!'),
      self::$line
    ];
    if ( \is_string($e) ){
      $msg[] = self::get_log_line('USER MESSAGE');
      $msg[] = $e;
    }
    else if ( method_exists($e, 'getMessage') ){
      $msg[] = self::get_log_line('DB MESSAGE');
      $msg[] = $e->getMessage();
    }
    $this->last_error = end($msg);
    $msg[] = self::get_log_line('QUERY');
    $msg[] = $this->last();
    if ( $this->last_params['values'] ){
      $msg[] =  self::get_log_line('VALUES');
      foreach ( $this->last_params['values'] as $v ){
        if ( $v === null ){
          $msg[] = 'NULL';
        }
        else if ( \is_bool($v) ){
          $msg[] = $v ? 'TRUE' : 'FALSE';
        }
        else if ( \is_string($v) ){
          $msg[] = str::is_buid($v) ? bin2hex($v) : str::cut($v, 30);
        }
        else{
          $msg[] = $v;
        }
      }
    }
    $msg[] =  self::get_log_line('BACKTRACE');
    $dbt = array_reverse(debug_backtrace());
    array_walk($dbt, function($a, $i) use(&$msg){
      $msg[] = str_repeat(' ', $i).($i ? '->' : '')."{$a['function']}  (".basename(dirname($a['file'])).'/'.basename($a['file']).":{$a['line']})";
    });
    $this->log(implode(PHP_EOL, $msg));
    if ( $this->on_error === self::E_DIE ){
      die(\defined('BBN_IS_DEV') && BBN_IS_DEV ? '<pre>'.PHP_EOL.implode(PHP_EOL, $msg).PHP_EOL.'</pre>' : 'Database error');
    }
  }
570138
def log(self, msg, error=False):
        """"""
        output = self.stdout
        if error:
            output = self.stderr

        output.write(msg)
        output.write('\n')
817856
public static function popErrorMask()
    {
        $lastMask = array_pop(self::$logLevelStack);
        error_reporting($lastMask[0]);
        self::$logMask = $lastMask[1];
    }
339817
protected function printErrors(): void
    {
        $this->output->writeln('');
        $this->output->writeln('');

        foreach ($this->errors as $error) {
            $this->output->write('<fg=red>ERROR   </> ' . $error['file'] . ':' . $error['line'] . ' - ');

            if ($error['type'] == 'class') {
                $this->output->write('Class <info>' . $error['class'] . '</info> is missing a docblock.');
            }

            if ($error['type'] == 'method') {
                $this->output->write('Method <info>' . $error['method'] . '</info> is missing a docblock.');
            }

            $this->output->writeln('');
        }
    }
434276
public function log()
    {
        if (is_null($this->log)) {
            $this->log = app(Log::class);
        }

        return $this->log;
    }
148157
protected function printReport()
    {
        $this->line(' --- ');
        if( !$this->errorOccurred() ) {
            $this->info('0 errors encountered.');
        } else {
            $this->error( count($this->messages->get('error')) .' error(s) encountered' );
            foreach( $this->messages->get('error') as $error ) {
                $this->error( $error );
            }
        }
    }
9933
public function log(array $log)
    {
        if ($this->loggerCallable) {
            call_user_func($this->loggerCallable, array_merge($this->logDefault, $log));
        }
    }
1078409
protected function errorsHandle()
    {
        $debug = $this->config('debug');

        error_reporting(($debug) ? E_ALL : E_ERROR & ~E_NOTICE);

        set_error_handler(function ($type, $message, $file, $line) {
            throw new \ErrorException($message, 0, $type, $file, $line);
        });

        set_exception_handler(function (\Exception $e) {

            $exception = new ExceptionsMiddleware;

            $log = $this->getLog(); // Force Slim to append log to env if not already
            $env = $this->environment();
            $env['slim.log'] = $log;
            $env['slim.log']->error($e);

            $this->contentType('text/html');
            $this->response()->status(500);

            echo $this->response()->body($exception->renderBody($env, $e));
        });

        register_shutdown_function(function () {

            if ( !is_null($options = error_get_last()) )
            {
                $title = 'Slimore Application Error Shutdown';

                $html  = html($title, [
                    '<meta http-equiv="X-UA-Compatible" content="IE=edge" />',
                    '<meta name="renderer" content="webkit" />',
                    '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />',
                    style([
                        '*{margin:0;padding:0;}',
                        'html {font-size: 62.5%;}',
                        'html, body {max-width: 100%;width: 100%;}',
                        'body {font-size: 1.4rem;font-family: "Microsoft Yahei", Helvetica, Tahoma, STXihei, arial,verdana,sans-serif;background:#fff;color:#555;}',
                        'img {border: none;}',
                        'pre, pre code {font-family:Consolas, arial,verdana,sans-serif;}',
                        '#layout {padding: 6rem;}',
                        '#main {margin: 0 auto;line-height: 1.5;}',
                        '#main > h1 {font-size: 10rem;margin-bottom: 1rem;}',
                        '#main > h3 {margin-bottom: 2rem; font-size: 1.8rem;}',
                        '#main > h4 {margin-bottom: 1rem; font-size: 1.8rem;}',
                        '#main pre {margin: 1.5rem 0;white-space: pre-wrap;word-wrap: break-word;}',
                        '#main > p {white-space: pre-wrap;word-wrap: break-word;line-height: 1.3;margin-bottom: 0.6rem;}',
                        '#main > p > strong {width: 7rem;display:inline-block;}',
                        '.logo {text-align: left;border-top:1px solid #eee;margin-top: 5rem;padding: 3rem 0 0;color: #ccc;}',
                        '.logo > h1 {font-weight: normal;font-size: 5rem;}',
                        '.logo img {margin-left: -2rem;}',
                        '.trace-line {padding: 0.3rem 0.6rem;margin-left:-0.6rem;-webkit-transition: background-color 300ms ease-out;transition: background-color 300ms ease-out;}',
                        '.trace-line:hover {background:#fffccc;}'
                    ])
                ], [
                    '<div id="layout">',
                    '<div id="main">',
                    '<h1>:(</h1>',
                    '<h3>' . $title . '</h3>',
                    '<h4>Details ：</h4>',
                    '<p><strong>Type: </strong> ' . $options['type'] . '</p>',
                    '<p><strong>Message: </strong> ' . $options['message'] . '</p>',
                    '<p><strong>File: </strong> ' . $options['file'] . '</p>',
                    '<p><strong>Line: </strong> ' . $options['line'] . '</p>',
                    '<div class="logo">',
                    '<h1>Slimore</h1>',
                    '<p>The fully (H)MVC framework, based on the Slim PHP Framwork.</p>',
                    '</div>',
                    '</div>',
                    '</div>'
                ]);

                echo $html;

                exit;
            }

        });
    }
686650
public function onShutdown()
    {
        // Get the last error if there was one, if not, let's get out of here.
        if (!$error = error_get_last()) {
            return;
        }

        $fatal  = array(E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR,E_USER_ERROR,E_RECOVERABLE_ERROR);
        if (!in_array($error['type'], $fatal)) {
            return;
        }

        $message   = '[Shutdown Error]: %s';
        $message   = sprintf($message, $error['message']);
        $backtrace = array(array('file' => $error['file'], 'line' => $error['line']));

        $this->client->notifyOnError($message, $backtrace, 'error');
        error_log($message.' in: '.$error['file'].':'.$error['line']);
    }
1147777
protected function log($message)
    {
        if (method_exists($this->io, 'writeError')) {
            $this->io->writeError($message);
        }
        else {
            // @codeCoverageIgnoreStart
            $this->io->write($message);
            // @codeCoverageIgnoreEn
        }
    }
669044
public function log(array $log)
    {
        if (null !== $this->config->getLoggerCallable()) {
            call_user_func_array($this->config->getLoggerCallable(), array($log));
        }
    }
563121
def log_error(cls, msg):
        
        cls.error_logger.error(msg)
        cls.debug_logger.debug(msg)
3940
protected function log()
    {
        if (!isset($this->options->filtered['log-junit'])) {
            return;
        }
        $output = $this->options->filtered['log-junit'];
        $writer = new Writer($this->interpreter, $this->options->path);
        $writer->write($output);
    }
208315
public function logVerbose()
  {
    if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERBOSE)
    {
      $args   = func_get_args();
      $format = array_shift($args);

      $this->writeln(vsprintf('<info>'.$format.'</info>', $args));
    }
  }
872601
public function logAction()
    {
        $flashMessenger = $this->getServiceLocator()->get('MelisCoreFlashMessenger');
        
        $success = $this->params()->fromRoute('success', $this->params()->fromQuery('success', ''));
        $title   = $this->params()->fromRoute('textTitle', $this->params()->fromQuery('textTitle', ''));
        $message = $this->params()->fromRoute('textMessage', $this->params()->fromQuery('textMessage', ''));
        $typeCode = $this->params()->fromRoute('typeCode', $this->params()->fromQuery('typeCode', ''));
        $itemId = $this->params()->fromRoute('itemId', $this->params()->fromQuery('itemId', ''));
    
        $img = $success == 1 ? $flashMessenger::INFO : $flashMessenger::WARNING;
    
        $flashMessenger->addToFlashMessenger($title, $message, $img);
        
        $logSrv = $this->getServiceLocator()->get('MelisCoreLogService');
        $logSrv->saveLog($title, $message, $success, $typeCode, $itemId);
    }
224732
public function logs() {
		$this->out('Deleting logs:');
		if (!empty($this->args)) {
			foreach ($this->args as $arg) {
				if (!is_dir(LOGS . $arg)) {
					$this->err('No log dir \'' . $arg . '\'');
					continue;
				}
				$this->out('\'' . $arg . '\' emptied');
				$this->_empty(LOGS . $arg);
			}
		} else {
			$this->_empty(LOGS);
			$this->out('All log files deleted');
		}
	}