Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ceventlogger.php
1<?php
2
4
5final class CEventLogger implements ILogger
6{
7 public function log(int $level, string $message, int $eventType = 0, array $context = [])
8 {
9 \CEventLog::Add(array(
10 "SEVERITY" => $this->getSeverity($level),
11 "AUDIT_TYPE_ID" => "LOCATION_MODULE_EVENT_".(string)$eventType,
12 "MODULE_ID" => "location",
13 "ITEM_ID" => "",
14 "DESCRIPTION" => $message
15 ));
16 }
17
18 private function getSeverity($logLevel)
19 {
20 if($logLevel <= 400)
21 {
22 $result = 'ERROR';
23 }
24 elseif($logLevel <= 500)
25 {
26 $result = 'WARNING';
27 }
28 elseif ($logLevel <= 700)
29 {
30 $result = 'INFO';
31 }
32 else
33 {
34 $result = 'DEBUG';
35 }
36 return $result;
37 }
38}
log(int $level, string $message, int $eventType=0, array $context=[])