Format the event error message.

@param \Crunz\Event $event

@return string
180929
protected function formatEventError(Event $event)
    {
        return $event->description
            . '('
            . $event->getCommandForDisplay()
            . ') '
            . PHP_EOL
            . $event->wholeOutput()
            . PHP_EOL;
    }
928445
protected function buildForegroundCommand(Event $event)
    {
        $output = ProcessUtils::escapeArgument($event->output);

        return $this->ensureCorrectUser(
            $event, $event->command.($event->shouldAppendOutput ? ' >> ' : ' > ').$output.' 2>&1'
        );
    }
322209
public function format(\n2n\log4php\logging\LoggingEvent $event) {
		$ns = $this->namespacePrefix;
		
		$loggerName = $event->getLoggerName();
		$timeStamp = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
		$thread = $event->getThreadName();
		$level = $event->getLevel()->toString();

		$buf  = "<$ns:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL;
		$buf .= "<$ns:message>"; 
		$buf .= $this->encodeCDATA($event->getRenderedMessage()); 
		$buf .= "</$ns:message>".PHP_EOL;

		$ndc = $event->getNDC();
		if(!empty($ndc)) {
			$buf .= "<$ns:NDC><![CDATA[";
			$buf .= $this->encodeCDATA($ndc);
			$buf .= "]]></$ns:NDC>".PHP_EOL;
		}
		
		$mdcMap = $event->getMDCMap();
		if (!empty($mdcMap)) {
			$buf .= "<$ns:properties>".PHP_EOL;
			foreach ($mdcMap as $name=>$value) {
				$buf .= "<$ns:data name=\"$name\" value=\"$value\" />".PHP_EOL;
			}
			$buf .= "</$ns:properties>".PHP_EOL;
		}

		if ($this->getLocationInfo()) {
			$locationInfo = $event->getLocationInformation();
			$buf .= "<$ns:locationInfo ". 
					"class=\"" . $locationInfo->getClassName() . "\" ".
					"file=\"" .  htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ".
					"line=\"" .  $locationInfo->getLineNumber() . "\" ".
					"method=\"" . $locationInfo->getMethodName() . "\" ";
			$buf .= "/>".PHP_EOL;
		}

		$buf .= "</$ns:event>".PHP_EOL;
		
		return $buf;
	}
663300
protected function handleError($event)
	{
		$trace=debug_backtrace();
		// skip the first 3 stacks as they do not tell the error position
		if(count($trace)>3)
			$trace=array_slice($trace,3);
		$traceString='';
		foreach($trace as $i=>$t)
		{
			if(!isset($t['file']))
				$trace[$i]['file']='unknown';

			if(!isset($t['line']))
				$trace[$i]['line']=0;

			if(!isset($t['function']))
				$trace[$i]['function']='unknown';

			$traceString.="#$i {$trace[$i]['file']}({$trace[$i]['line']}): ";
			if(isset($t['object']) && is_object($t['object']))
				$traceString.=get_class($t['object']).'->';
			$traceString.="{$trace[$i]['function']}()\n";

			unset($trace[$i]['object']);
		}

		$app=Yii::app();
		if($app instanceof CWebApplication)
		{
			switch($event->code)
			{
				case E_WARNING:
					$type = 'PHP warning';
					break;
				case E_NOTICE:
					$type = 'PHP notice';
					break;
				case E_USER_ERROR:
					$type = 'User error';
					break;
				case E_USER_WARNING:
					$type = 'User warning';
					break;
				case E_USER_NOTICE:
					$type = 'User notice';
					break;
				case E_RECOVERABLE_ERROR:
					$type = 'Recoverable error';
					break;
				default:
					$type = 'PHP error';
			}
			$this->_exception=null;
			$this->_error=array(
				'code'=>500,
				'type'=>$type,
				'message'=>$event->message,
				'file'=>$event->file,
				'line'=>$event->line,
				'trace'=>$traceString,
				'traces'=>$trace,
			);
			if(!headers_sent())
			{
				$httpVersion=Yii::app()->request->getHttpVersion();
				header("HTTP/$httpVersion 500 Internal Server Error");
			}

			$this->renderError();
		}
		else
			$app->displayError($event->code,$event->message,$event->file,$event->line);
	}
760928
protected String formatAnnounceEvent(
          AnnounceRequestMessage.RequestEvent event) {
    return AnnounceRequestMessage.RequestEvent.NONE.equals(event)
            ? ""
            : String.format(" %s", event.name());
  }
1262182
public static function formatMessage($message): string
    {
        if ($message instanceof \Throwable) {
            while ($message) {
                $tmp[] = ($message instanceof \ErrorException
                        ? Helpers::errorTypeToString($message->getSeverity()) . ': ' . $message->getMessage()
                        : Helpers::getClass($message) . ': ' . $message->getMessage() . ($message->getCode() ? ' #' . $message->getCode() : '')
                    ) . ' in ' . $message->getFile() . ':' . $message->getLine();
                $message = $message->getPrevious();
            }
            $message = \implode("\ncaused by ", $tmp);

        } elseif (!\is_string($message)) {
            $message = self::toText($message);
        }

        return \trim($message);
    }
593999
public function encode(string $event, $data)
    {
        $packet = Packet::MESSAGE . Packet::EVENT;
        $shouldEncode = is_array($data) || is_object($data);
        $data = $shouldEncode ? json_encode($data) : $data;
        $format = $shouldEncode ? '["%s",%s]' : '["%s","%s"]';

        return $packet . sprintf($format, $event, $data);
    }
852516
public function classNameForEvent($event): string
    {
        if ( ! isset($this->eventClasses[$event])) {
            throw new \InvalidArgumentException("Could not find a class for the event {$event}.");
        }
        return $this->eventClasses[$event];
    }
1186375
public function format($event)
    {
        /** Retrieve the line and file if set and remove them from the formatted extra */
        $file       = $line = '';
        $priorities = 0;

        /** @noinspection UnSafeIsSetOverArrayInspection */
        if (isset($event['extra']['file'])) {
            $file = $event['extra']['file'];

            unset($event['extra']['file']);
        }

        /** @noinspection UnSafeIsSetOverArrayInspection */
        if (isset($event['extra']['line'])) {
            $line = $event['extra']['line'];

            unset($event['extra']['line']);
        }

        $event = $this->normalize($event);

        $message = ['message' => $event['message']];

        if ($event['context']) {
            $message['context'] = $event['context'];
        }

        if ($event['extra']) {
            $message['extra'] = $event['extra'];
        }

        /** @noinspection UnSafeIsSetOverArrayInspection */
        if (isset($this->priorities[$event['level']])) {
            $priorities = $this->priorities[$event['level']];
        }

        if (count($message) === 1) {
            $message = reset($message);
        }

        /** Create JSON object describing the appearance of the message in the console */
        $json = $this->toJson(
            [
                [
                    'Type'  => $priorities,
                    'File'  => $file,
                    'Line'  => $line,
                    'Label' => $event['channel']
                ],
                $message
            ]
        );

        return sprintf('%s|%s|', strlen($json), $json);
    }
691171
static public function formatError($string)
    {
        $words = explode('-', $string);
        $f = 'error';

        foreach($words as $word) {
            $f .= ucfirst($word);
        }

        return $f;
    }
844309
public function handleError($event)
    {
        $event->handled = true;
        $message = $event->message;
        if (YII_DEBUG) {
            $trace = debug_backtrace();
            if (isset($trace[2]) && isset($trace[2]['file']) && isset($trace[2]['line'])) {
                $message .= ' (' . $trace[2]['file'] . ':' . $trace[2]['line'] . ')';
            }
        }
        throw new \Exception($message, self::SOAP_ERROR);
    }
217162
protected function outputFormatTableEvent(array $events)
    {
        $header = array(
            $this->text('Text'),
            $this->text('Type'),
            $this->text('Severity'),
            $this->text('Created')
        );

        $rows = array();

        foreach ($events as $item) {
            $text = empty($item['translatable']) ? $item['text'] : $this->text($item['text']);
            $rows[] = array(
                $this->truncate($text, 50),
                $this->text($item['type']),
                $this->text($item['severity']),
                $this->date($item['created']),
            );
        }

        $this->outputFormatTable($rows, $header);
    }
874005
def format( event )
      obj = format_obj(event.data)
      sprintf("%*s  %s : %s\n", ::Logging::MAX_LEVEL_LENGTH,
              ::Logging::LNAMES[event.level], event.logger, obj)
    end
72330
protected function buildCondition($event) {
        $conditions = array();
        foreach ($event->getActions() as $action) {
            $conditions[$action] = 'Event.MenuNavAction == CMlEvent::EMenuNavAction::' . $action;
        }

        $result = '';
        if (!empty($conditions)) {
            $result = implode(' || ', $conditions);
        }
        return $result;
    }
946338
public function getEventClassName(string $event)
    {
        if (isset(self::$eventsMap[$event])) {
            return self::$eventsMap[$event];
        }

        $listeners = $this->eventDispatcher->getListeners($event);
        if (empty($listeners)) {
            return null;
        }

        foreach ($listeners as $listener) {
            if (!\is_array($listener) || 2 !== \count($listener)) {
                continue;
            }

            $reflectionMethod = new \ReflectionMethod($listener[0], $listener[1]);
            $args = $reflectionMethod->getParameters();
            if (!$args) {
                continue;
            }

            if (null !== $type = $args[0]->getType()) {
                return (string) $type;
            }
        }

        return null;
    }
509554
protected static function format_event( stdClass $event ) {

		$event->next_run          = get_date_from_gmt( date( 'Y-m-d H:i:s', $event->time ), self::$time_format );
		$event->next_run_gmt      = date( self::$time_format, $event->time );
		$event->next_run_relative = self::interval( $event->time - time() );
		$event->recurrence        = ( $event->schedule ) ? self::interval( $event->interval ) : 'Non-repeating';

		return $event;
	}
374640
public function col_context($event) {
        // Add context name.
        if ($event->contextid) {
            // If context name was fetched before then return, else get one.
            if (isset($this->contextname[$event->contextid])) {
                return $this->contextname[$event->contextid];
            } else {
                $context = context::instance_by_id($event->contextid, IGNORE_MISSING);
                if ($context) {
                    $contextname = $context->get_context_name(true);
                    if ($url = $context->get_url()) {
                        $contextname = html_writer::link($url, $contextname);
                    }
                } else {
                    $contextname = get_string('other');
                }
            }
        } else {
            $contextname = get_string('other');
        }

        $this->contextname[$event->contextid] = $contextname;
        return $contextname;
    }