1 | <?php |
||
33 | trait ExtendedLoggerTrait |
||
34 | { |
||
35 | use GlobbingTrait; |
||
36 | |||
37 | /** |
||
38 | * Collection of handler queues |
||
39 | * |
||
40 | * @var array |
||
41 | * @access protected |
||
42 | */ |
||
43 | protected $handlers = []; |
||
44 | |||
45 | /** |
||
46 | * Collection of processor queues |
||
47 | * |
||
48 | * @var array |
||
49 | * @access protected |
||
50 | */ |
||
51 | protected $processors = []; |
||
52 | |||
53 | /** |
||
54 | * channel name |
||
55 | * |
||
56 | * @var string |
||
57 | * @access protected |
||
58 | */ |
||
59 | protected $channel = 'LOGGER'; |
||
60 | |||
61 | /** |
||
62 | * marker for set channel |
||
63 | * |
||
64 | * @var bool |
||
65 | * @access protected |
||
66 | */ |
||
67 | protected $channel_set = false; |
||
68 | |||
69 | /** |
||
70 | * Set channel for this log |
||
71 | * |
||
72 | * @param string $channel |
||
73 | * @return $this |
||
74 | * @access protected |
||
75 | */ |
||
76 | protected function setChannel(/*# string */ $channel) |
||
82 | |||
83 | /** |
||
84 | * Get logger channel |
||
85 | * |
||
86 | * @return string |
||
87 | * @access protected |
||
88 | */ |
||
89 | protected function getChannel()/*# : string */ |
||
93 | |||
94 | /** |
||
95 | * Add callable to the $type queue |
||
96 | * |
||
97 | * @param string $type 'handlers' or 'processors' |
||
98 | * @param callable $callable |
||
99 | * @param string $channel |
||
100 | * @param int $priority -100 - +100 |
||
101 | * @return $this |
||
102 | * @access protected |
||
103 | */ |
||
104 | protected function addCallable( |
||
126 | |||
127 | /** |
||
128 | * Remove callable for $type |
||
129 | * |
||
130 | * @param string $type |
||
131 | * @param callable $callable |
||
132 | * @param string $channel |
||
133 | * @return $this |
||
134 | * @access protected |
||
135 | */ |
||
136 | protected function removeCallable( |
||
153 | |||
154 | /** |
||
155 | * Get all the channels for handlers or processors |
||
156 | * |
||
157 | * @param string $type 'handlers' or 'processors' |
||
158 | * @return array |
||
159 | * @access protected |
||
160 | */ |
||
161 | protected function getAllChannels(/*# string */ $type)/*# : array */ |
||
165 | |||
166 | /** |
||
167 | * Execute related processors on the log entry |
||
168 | * |
||
169 | * @param LogEntryInterface $logEntry |
||
170 | * @return $this |
||
171 | * @access protected |
||
172 | */ |
||
173 | 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) |
||
211 | |||
212 | /** |
||
213 | * Get all matching handlers/processors with channel name globbing |
||
214 | * |
||
215 | * @param string $type |
||
216 | * @param string $channel |
||
217 | * @return PriorityQueue |
||
218 | * @access protected |
||
219 | */ |
||
220 | protected function getCallables( |
||
241 | |||
242 | /** |
||
243 | * Check if channel is set with $logger($channel) |
||
244 | * |
||
245 | * @throws RuntimeException |
||
246 | * @access protected |
||
247 | */ |
||
248 | protected function isChannelSet() |
||
257 | |||
258 | /** |
||
259 | * Mark channel is unset |
||
260 | * |
||
261 | * @access protected |
||
262 | */ |
||
263 | protected function unsetChannel() |
||
267 | } |
||
268 |