Elgg  Version 5.1
ErrorFormatter.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Cli;
4 
8 
13 
14  const SIMPLE_FORMAT = '%level_name%: %message%';
15 
19  public function format(array $record): string {
20  $message = parent::format($record);
21 
22  $formatter = new FormatterHelper();
23 
24  switch ($record['level']) {
25  case Logger::EMERGENCY:
26  case Logger::CRITICAL:
27  case Logger::ALERT:
28  case Logger::ERROR:
29  $style = 'error';
30  break;
31 
32  case Logger::WARNING:
33  $style = 'comment';
34  break;
35 
36  default:
37  $style = 'info';
38  break;
39  }
40 
41  return $formatter->formatBlock($message, $style);
42  }
43 }
Custom log formatter.
format(array $record)
{}
$style
Definition: full.php:95
Format errors for console output.