Elgg  Version 6.1
ErrorFormatter.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Cli;
4 
6 use Monolog\Level;
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 Level::Emergency:
27  case Level::Critical:
28  case Level::Alert:
29  case Level::Error:
30  $style = 'error';
31  break;
32 
33  case Level::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.