Elgg
Version 6.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Cli
ErrorFormatter.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Cli
;
4
5
use
Elgg\Logger\ElggLogFormatter
;
6
use
Monolog\Level
;
7
use
Monolog\LogRecord
;
8
use
Symfony\Component\Console\Helper\FormatterHelper
;
9
13
class
ErrorFormatter
extends
ElggLogFormatter
{
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
}
FormatterHelper
Elgg\Logger\ElggLogFormatter
Custom log formatter.
Definition:
ElggLogFormatter.php:12
LogRecord
ElggLogFormatter
Elgg\Cli\ErrorFormatter\SIMPLE_FORMAT
const SIMPLE_FORMAT
Definition:
ErrorFormatter.php:15
$message
$message
Definition:
set_maintenance_mode.php:7
Elgg\Cli\ErrorFormatter\format
format(LogRecord $record)
{}
Definition:
ErrorFormatter.php:20
Level
Elgg\Cli
Definition:
Application.php:3
$style
$style
Definition:
full.php:95
Elgg\Cli\ErrorFormatter
Format errors for console output.
Definition:
ErrorFormatter.php:13
Generated on Sat Nov 9 2024 00:00:21 for Elgg by
1.8.11