Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
databaselogger.php
1<?php
2
4
7use Exception;
8
10{
11
20 protected function logMessage(string $level, string $message)
21 {
22 CalendarLogTable::add([
23 'MESSAGE' => $message,
24 ]);
25 }
26
27 public function logToDatabase(array $context)
28 {
29 $fields = [];
30 if (isset($context['serviceName']))
31 {
32 $fields['TYPE'] = (string)$context['serviceName'];
33 unset($context['serviceName']);
34 }
35
36 if (isset($context['userId']))
37 {
38 $fields['USER_ID'] = (int)$context['userId'];
39 unset($context['userId']);
40 }
41
42 if (isset($context['loggerUuid']))
43 {
44 $fields['UUID'] = (string)$context['loggerUuid'];
45 unset($context['loggerUuid']);
46 }
47
48 $fields['MESSAGE'] = var_export($context, true);
49
50 CalendarLogTable::add($fields);
51 }
52}
logMessage(string $level, string $message)