1 | <?php |
||
23 | abstract class Target extends Component |
||
24 | { |
||
25 | /** |
||
26 | * @var bool whether to enable this log target. Defaults to true. |
||
27 | */ |
||
28 | public $enabled = true; |
||
29 | /** |
||
30 | * @var array list of message categories that this target is interested in. Defaults to empty, meaning all categories. |
||
31 | * You can use an asterisk at the end of a category so that the category may be used to |
||
32 | * match those categories sharing the same common prefix. For example, 'yii\db\*' will match |
||
33 | * categories starting with 'yii\db\', such as `yii\db\Connection`. |
||
34 | */ |
||
35 | public $categories = []; |
||
36 | /** |
||
37 | * @var array list of message categories that this target is NOT interested in. Defaults to empty, meaning no uninteresting messages. |
||
38 | * If this property is not empty, then any category listed here will be excluded from [[categories]]. |
||
39 | * You can use an asterisk at the end of a category so that the category can be used to |
||
40 | * match those categories sharing the same common prefix. For example, 'yii\db\*' will match |
||
41 | * categories starting with 'yii\db\', such as `yii\db\Connection`. |
||
42 | * @see categories |
||
43 | */ |
||
44 | public $except = []; |
||
45 | |||
46 | |||
47 | /** |
||
48 | * Processes the given log messages. |
||
49 | * This method will filter the given messages with [[levels]] and [[categories]]. |
||
50 | * And if requested, it will also export the filtering result to specific medium (e.g. email). |
||
51 | * @param array $messages profiling messages to be processed. See [[Logger::messages]] for the structure |
||
52 | * of each message. |
||
53 | */ |
||
54 | 1 | public function collect(array $messages) |
|
65 | |||
66 | /** |
||
67 | * Exports profiling messages to a specific destination. |
||
68 | * Child classes must implement this method. |
||
69 | * @param array $messages profiling messages to be exported. |
||
70 | */ |
||
71 | abstract public function export(array $messages); |
||
72 | |||
73 | /** |
||
74 | * Filters the given messages according to their categories. |
||
75 | * @param array $messages messages to be filtered. |
||
76 | * The message structure follows that in [[Logger::messages]]. |
||
77 | * @return array the filtered messages. |
||
78 | */ |
||
79 | 6 | protected function filterMessages($messages) |
|
106 | } |