1 | <?php |
||
30 | final class ConsoleLogger extends AbstractLogger |
||
31 | { |
||
32 | public const INFO = 'info'; |
||
33 | public const ERROR = 'error'; |
||
34 | |||
35 | /** @var OutputInterface */ |
||
36 | private $output; |
||
37 | |||
38 | /** @var array<string, int> */ |
||
39 | private $verbosityLevelMap = [ |
||
40 | LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, |
||
41 | LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, |
||
42 | LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, |
||
43 | LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL, |
||
44 | LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL, |
||
45 | LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, |
||
46 | LogLevel::INFO => OutputInterface::VERBOSITY_VERBOSE, |
||
47 | LogLevel::DEBUG => OutputInterface::VERBOSITY_VERY_VERBOSE, |
||
48 | ]; |
||
49 | /** @var array<string, string> */ |
||
50 | private $formatLevelMap = [ |
||
51 | LogLevel::EMERGENCY => self::ERROR, |
||
52 | LogLevel::ALERT => self::ERROR, |
||
53 | LogLevel::CRITICAL => self::ERROR, |
||
54 | LogLevel::ERROR => self::ERROR, |
||
55 | LogLevel::WARNING => self::INFO, |
||
56 | LogLevel::NOTICE => self::INFO, |
||
57 | LogLevel::INFO => self::INFO, |
||
58 | LogLevel::DEBUG => self::INFO, |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * @param array<string, int> $verbosityLevelMap |
||
63 | * @param array<string, string> $formatLevelMap |
||
64 | */ |
||
65 | 49 | public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = []) |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 22 | public function log($level, $message, array $context = []) : void |
|
98 | |||
99 | /** |
||
100 | * Interpolates context values into the message placeholders. |
||
101 | * |
||
102 | * @param mixed[] $context |
||
103 | */ |
||
104 | 21 | private function interpolate(string $message, array $context) : string |
|
131 | } |
||
132 |