1 | <?php |
||
18 | class LoggerManager extends AbstractLogger implements StylableLoggerInterface |
||
19 | { |
||
20 | /** @var LoggerInterface[] */ |
||
21 | protected $loggers = []; |
||
22 | /** @var LoggerInterface */ |
||
23 | protected $fallbackLogger = null; |
||
24 | /** @var LogOutputStylerInterface */ |
||
25 | protected $outputStyler; |
||
26 | /** @var array */ |
||
27 | protected $formatFunctionMap = []; |
||
28 | |||
29 | /** |
||
30 | * reset removes all loggers from the manager. |
||
31 | */ |
||
32 | public function reset() |
||
37 | |||
38 | /** |
||
39 | * setLogOutputStyler will remember a style that |
||
40 | * should be applied to every stylable logger |
||
41 | * added to this manager. |
||
42 | */ |
||
43 | public function setLogOutputStyler(LogOutputStylerInterface $outputStyler, array $formatFunctionMap = array()) |
||
48 | |||
49 | /** |
||
50 | * add adds a named logger to the manager, |
||
51 | * replacing any logger of the same name. |
||
52 | * |
||
53 | * @param string $name Name of logger to add |
||
54 | * @param LoggerInterface $logger Logger to send messages to |
||
55 | */ |
||
56 | public function add($name, LoggerInterface $logger) |
||
68 | |||
69 | /** |
||
70 | * remove a named logger from the manager. |
||
71 | * |
||
72 | * @param string $name Name of the logger to remove. |
||
73 | */ |
||
74 | public function remove($name) |
||
79 | |||
80 | /** |
||
81 | * fallbackLogger provides a logger that will |
||
82 | * be used only in instances where someone logs |
||
83 | * to the logger manager at a time when there |
||
84 | * are no other loggers registered. If there is |
||
85 | * no fallback logger, then the log messages |
||
86 | * are simply dropped. |
||
87 | * |
||
88 | * @param LoggerInterface $logger Logger to use as the fallback logger |
||
89 | */ |
||
90 | public function fallbackLogger(LoggerInterface $logger) |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function log($level, $message, array $context = array()) |
||
105 | |||
106 | /** |
||
107 | * Return either the list of registered loggers, |
||
108 | * or a single-element list containing only the |
||
109 | * fallback logger. |
||
110 | */ |
||
111 | protected function getLoggers() |
||
121 | } |
||
122 |