1 | <?php |
||
18 | class LoggerManager extends AbstractLogger |
||
19 | { |
||
20 | /** @var LoggerInterface[] */ |
||
21 | protected $loggers = []; |
||
22 | /** @var LoggerInterface */ |
||
23 | protected $fallbackLogger = null; |
||
24 | |||
25 | /** |
||
26 | * reset removes all loggers from the manager. |
||
27 | */ |
||
28 | public function reset() |
||
33 | |||
34 | /** |
||
35 | * add adds a named logger to the manager, |
||
36 | * replacing any logger of the same name. |
||
37 | * |
||
38 | * @param string $name Name of logger to add |
||
39 | * @param LoggerInterface $logger Logger to send messages to |
||
40 | */ |
||
41 | public function add($name, LoggerInterface $logger) |
||
46 | |||
47 | /** |
||
48 | * remove a named logger from the manager. |
||
49 | * |
||
50 | * @param string $name Name of the logger to remove. |
||
51 | */ |
||
52 | public function remove($name) |
||
57 | |||
58 | /** |
||
59 | * fallbackLogger provides a logger that will |
||
60 | * be used only in instances where someone logs |
||
61 | * to the logger manager at a time when there |
||
62 | * are no other loggers registered. If there is |
||
63 | * no fallback logger, then the log messages |
||
64 | * are simply dropped. |
||
65 | * |
||
66 | * @param LoggerInterface $logger Logger to use as the fallback logger |
||
67 | */ |
||
68 | public function fallbackLogger(LoggerInterface $logger) |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function log($level, $message, array $context = array()) |
||
83 | |||
84 | /** |
||
85 | * Return either the list of registered loggers, |
||
86 | * or a single-element list containing only the |
||
87 | * fallback logger. |
||
88 | */ |
||
89 | protected function getLoggers() |
||
99 | } |
||
100 |