1 | <?php |
||
13 | class LogOutputStyler extends UnstyledLogOutputStyler |
||
14 | { |
||
15 | const TASK_STYLE_INFO = 'fg=white;bg=cyan;options=bold'; |
||
16 | const TASK_STYLE_SUCCESS = 'fg=white;bg=green;options=bold'; |
||
17 | const TASK_STYLE_WARNING = 'fg=black;bg=yellow;options=bold;'; |
||
18 | const TASK_STYLE_ERROR = 'fg=white;bg=red;options=bold'; |
||
19 | |||
20 | protected $defaultStyles = [ |
||
21 | '*' => LogLevel::INFO, |
||
22 | ]; |
||
23 | protected $labelStyles = [ |
||
24 | LogLevel::EMERGENCY => self::TASK_STYLE_ERROR, |
||
25 | LogLevel::ALERT => self::TASK_STYLE_ERROR, |
||
26 | LogLevel::CRITICAL => self::TASK_STYLE_ERROR, |
||
27 | LogLevel::ERROR => self::TASK_STYLE_ERROR, |
||
28 | LogLevel::WARNING => self::TASK_STYLE_WARNING, |
||
29 | LogLevel::NOTICE => self::TASK_STYLE_INFO, |
||
30 | LogLevel::INFO => self::TASK_STYLE_INFO, |
||
31 | LogLevel::DEBUG => self::TASK_STYLE_INFO, |
||
32 | ConsoleLogLevel::SUCCESS => self::TASK_STYLE_SUCCESS, |
||
33 | ]; |
||
34 | protected $messageStyles = [ |
||
35 | LogLevel::EMERGENCY => self::TASK_STYLE_ERROR, |
||
36 | LogLevel::ALERT => self::TASK_STYLE_ERROR, |
||
37 | LogLevel::CRITICAL => self::TASK_STYLE_ERROR, |
||
38 | LogLevel::ERROR => self::TASK_STYLE_ERROR, |
||
39 | LogLevel::WARNING => '', |
||
40 | LogLevel::NOTICE => '', |
||
41 | LogLevel::INFO => '', |
||
42 | LogLevel::DEBUG => '', |
||
43 | ConsoleLogLevel::SUCCESS => '', |
||
44 | ]; |
||
45 | |||
46 | public function __construct($labelStyles = [], $messageStyles = []) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function defaultStyles() |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function style($context) |
||
79 | |||
80 | /** |
||
81 | * Wrap a string in a format element. |
||
82 | */ |
||
83 | protected function wrapFormatString($string, $style) |
||
90 | |||
91 | /** |
||
92 | * Look up the label and message styles for the specified log level, |
||
93 | * and use the log level as the label for the log message. |
||
94 | */ |
||
95 | protected function formatMessageByLevel($level, $message, $context) |
||
100 | |||
101 | /** |
||
102 | * Apply styling with the provided label and message styles. |
||
103 | */ |
||
104 | protected function formatMessage($label, $message, $context, $labelStyle, $messageStyle = '') |
||
115 | } |
||
116 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.