Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
logger.php
1<?
2namespace Bitrix\Scale;
3
5Loc::loadMessages(__FILE__);
6
12class Logger
13{
15 const LOG_LEVEL_ERROR = 10;
16 const LOG_LEVEL_INFO = 20;
17 const LOG_LEVEL_DEBUG = 30;
18
26 public static function addRecord($level, $auditType, $itemId, $description)
27 {
28 if($level == self::LOG_LEVEL_ERROR)
29 $severity = "ERROR";
30 elseif($level == self::LOG_LEVEL_INFO)
31 $severity = "INFO";
32 elseif($level == self::LOG_LEVEL_DEBUG)
33 $severity = "DEBUG";
34 else
35 $severity = "UNKNOWN";
36
37 \CEventLog::Add(array(
38 "SEVERITY" => $severity,
39 "AUDIT_TYPE_ID" => $auditType,
40 "MODULE_ID" => "scale",
41 "ITEM_ID" => $itemId,
42 "DESCRIPTION" => $description,
43 ));
44
45 return true;
46 }
47
51 public static function onEventLogGetAuditTypes()
52 {
53 return array(
54 "SCALE_ACTION_STARTED" => "[SCALE_ACTION_STARTED] ".Loc::getMessage("SCALE_ACTION_EVENT_LOG_TYPE_ACTION_STARTED"),
55 "SCALE_ACTION_RESULT" => "[SCALE_ACTION_RESULT] ".Loc::getMessage("SCALE_ACTION_EVENT_LOG_TYPE_ACTION_RESULT"),
56 "SCALE_ACTION_ERROR" => "[SCALE_ACTION_ERROR] ".Loc::getMessage("SCALE_ACTION_EVENT_LOG_TYPE_ACTION_ERROR"),
57 "SCALE_ACTION_OUTPUT" => "[SCALE_ACTION_OUTPUT] ".Loc::getMessage("SCALE_ACTION_EVENT_LOG_TYPE_ACTION_OUTPUT"),
58 "SCALE_ACTION_CHECK_STATE" => "[SCALE_ACTION_CHECK_STATE] ".Loc::getMessage("SCALE_ACTION_EVENT_LOG_TYPE_ACTION_CHECK_STATE"),
59 "SCALE_PROVIDER_SEND_ORDER" => "[SCALE_PROVIDER_SEND_ORDER] ".Loc::getMessage("SCALE_ACTION_EVENT_LOG_TYPE_PROVIDER_SEND_ORDER")
60 );
61 }
62}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
const LOG_LEVEL_DISABLE
Definition logger.php:14
static addRecord($level, $auditType, $itemId, $description)
Definition logger.php:26
const LOG_LEVEL_DEBUG
Definition logger.php:17
const LOG_LEVEL_ERROR
Definition logger.php:15
static onEventLogGetAuditTypes()
Definition logger.php:51