1 | <?php |
||
21 | class Logger extends AbstractLogger |
||
22 | { |
||
23 | /** |
||
24 | * Holds all the registered loggers as buckets. |
||
25 | * |
||
26 | * @var Logger\LoggerInterface[]. |
||
27 | */ |
||
28 | protected $buckets = array(); |
||
29 | |||
30 | /** |
||
31 | * Constructor. |
||
32 | * |
||
33 | * @param Logger\LoggerInterface[] $loggers |
||
34 | */ |
||
35 | 80 | public function __construct(array $loggers = array()) |
|
52 | |||
53 | /** |
||
54 | * Processes the given log. |
||
55 | * (overwrite abstract). |
||
56 | * |
||
57 | * @param LogEntry $log The log record to handle. |
||
58 | * |
||
59 | * @return bool False when not processed. |
||
60 | */ |
||
61 | 36 | public function process(LogEntry $log) |
|
77 | |||
78 | /** |
||
79 | * Checks if any log bucket can hanle the given code. |
||
80 | * |
||
81 | * @param int $level_code |
||
82 | * |
||
83 | * @return int|false |
||
84 | */ |
||
85 | 36 | protected function getIndexFirstBucket($level_code) |
|
95 | |||
96 | /** |
||
97 | * Gets the name of the PSR-3 logging level. |
||
98 | * |
||
99 | * @param string $level_name |
||
100 | * |
||
101 | * @return string |
||
102 | * |
||
103 | * @throws InvalidArgumentException |
||
104 | */ |
||
105 | 8 | public static function getPsrLevelName($level_name) |
|
116 | |||
117 | /** |
||
118 | * Adds a logger. |
||
119 | * |
||
120 | * @param Logger\LoggerInterface $logger |
||
121 | * |
||
122 | * @return bool Returns TRUE on success or FALSE on failure. |
||
123 | */ |
||
124 | 32 | public function add(Logger\LoggerInterface $logger) |
|
130 | |||
131 | /** |
||
132 | * Sorts the log buckets, prioritizes top-down by minimal level. |
||
133 | * Beware: Exisiting level will be in FIFO order. |
||
134 | * |
||
135 | * @return bool Returns TRUE on success or FALSE on failure. |
||
136 | */ |
||
137 | 80 | protected function sortBuckets() |
|
145 | |||
146 | /** |
||
147 | * Returns all the registered log buckets. |
||
148 | * |
||
149 | * @return array |
||
150 | */ |
||
151 | 16 | public function getBuckets() |
|
155 | } |
||
156 |