1 | <?php |
||
32 | trait ExtendedLoggerTrait |
||
33 | { |
||
34 | use GlobbingTrait; |
||
35 | |||
36 | /** |
||
37 | * Collection of handler queues |
||
38 | * |
||
39 | * @var array |
||
40 | * @access protected |
||
41 | */ |
||
42 | protected $handlers = []; |
||
43 | |||
44 | /** |
||
45 | * Collection of processor queues |
||
46 | * |
||
47 | * @var array |
||
48 | * @access protected |
||
49 | */ |
||
50 | protected $processors = []; |
||
51 | |||
52 | /** |
||
53 | * channel name |
||
54 | * |
||
55 | * @var string |
||
56 | * @access protected |
||
57 | */ |
||
58 | protected $channel = 'LOGGER'; |
||
59 | |||
60 | /** |
||
61 | * marker for set channel |
||
62 | * |
||
63 | * @var bool |
||
64 | * @access protected |
||
65 | */ |
||
66 | protected $channel_set = false; |
||
67 | |||
68 | /** |
||
69 | * Set channel for this log |
||
70 | * |
||
71 | * @param string $channel |
||
72 | * @return $this |
||
73 | * @access protected |
||
74 | */ |
||
75 | protected function setChannel(/*# string */ $channel) |
||
81 | |||
82 | /** |
||
83 | * Get logger channel |
||
84 | * |
||
85 | * @return string |
||
86 | * @access protected |
||
87 | */ |
||
88 | protected function getChannel()/*# : string */ |
||
92 | |||
93 | /** |
||
94 | * Add callable to the $type queue |
||
95 | * |
||
96 | * @param string $type 'handlers' or 'processors' |
||
97 | * @param callable $callable |
||
98 | * @param string $channel |
||
99 | * @param int $priority -100 - +100 |
||
100 | * @return $this |
||
101 | * @access protected |
||
102 | */ |
||
103 | protected function addCallable( |
||
125 | |||
126 | /** |
||
127 | * Remove callable for $type |
||
128 | * |
||
129 | * @param string $type |
||
130 | * @param callable $callable |
||
131 | * @param string $channel |
||
132 | * @return $this |
||
133 | * @access protected |
||
134 | */ |
||
135 | protected function removeCallable( |
||
152 | |||
153 | /** |
||
154 | * Get all the channels for handlers or processors |
||
155 | * |
||
156 | * @param string $type 'handlers' or 'processors' |
||
157 | * @return array |
||
158 | * @access protected |
||
159 | */ |
||
160 | protected function getAllChannels(/*# string */ $type)/*# : array */ |
||
164 | |||
165 | /** |
||
166 | * Execute related processors on the log entry |
||
167 | * |
||
168 | * @param LogEntryInterface $logEntry |
||
169 | * @return $this |
||
170 | * @access protected |
||
171 | */ |
||
172 | protected function runProcessors(LogEntryInterface $logEntry) |
||
185 | |||
186 | /** |
||
187 | * Execute related handlers on the log entry |
||
188 | * |
||
189 | * @param LogEntryInterface $logEntry |
||
190 | * @return $this |
||
191 | * @access protected |
||
192 | */ |
||
193 | protected function runHandlers(LogEntryInterface $logEntry) |
||
213 | |||
214 | /** |
||
215 | * Get all matching handlers/processors with channel name globbing |
||
216 | * |
||
217 | * @param string $channel |
||
218 | * @return PriorityQueue |
||
219 | * @access protected |
||
220 | */ |
||
221 | protected function getCallables( |
||
242 | |||
243 | /** |
||
244 | * Is this handler can do this log ? |
||
245 | * |
||
246 | * @param LogEntryInterface $logEntry |
||
247 | * @param callable $handler |
||
248 | * @return bool |
||
249 | * @access protected |
||
250 | */ |
||
251 | protected function isValidHandler( |
||
261 | |||
262 | /** |
||
263 | * Check if channel is set with $logger($channel) |
||
264 | * |
||
265 | * @throws RuntimeException |
||
266 | * @access protected |
||
267 | */ |
||
268 | protected function isChannelSet() |
||
277 | |||
278 | /** |
||
279 | * Mark channel is unset |
||
280 | * |
||
281 | * @access protected |
||
282 | */ |
||
283 | protected function unsetChannel() |
||
287 | } |
||
288 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.