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