1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
DataBaseLogger.php
См. документацию.
1<?php
2
4
8
14{
15 private ?int $logId = null;
16
17 protected function logMessage(string $level, string $message)
18 {
19 if ($this->shouldLog() && LoggerManager::getInstance()->isActive())
20 {
21 $result = LogTable::add(
22 [
23 'CLIENT_ID' => $this->context['CLIENT_ID'] ?? null,
24 'PASSWORD_ID' => $this->context['PASSWORD_ID'] ?? null,
25 'SCOPE' => $this->context['SCOPE'] ?? null,
26 'METHOD' => $this->context['METHOD'] ?? null,
27 'EVENT_ID' => $this->context['EVENT_ID'] ?? null,
28 'REQUEST_METHOD' => $this->context['REQUEST_METHOD'] ?? null,
29 'REQUEST_URI' => $this->context['REQUEST_URI'] ?? null,
30 'REQUEST_AUTH' => $this->context['REQUEST_AUTH'] ?? null,
31 'REQUEST_DATA' => $this->context['REQUEST_DATA'] ?? null,
32 'RESPONSE_STATUS' => $this->context['RESPONSE_STATUS'] ?? null,
33 'RESPONSE_DATA' => $this->context['RESPONSE_DATA'] ?? null,
34 'MESSAGE' => $this->context['MESSAGE'] ?? $message,
35 ]
36 );
37 $this->logId = $result->isSuccess() ? $result->getId() : null;
38 }
39 }
40
41 public function log($level, \Stringable|string $message, array $context = []): void
42 {
44
45 parent::log($level, $message, $context);
46 }
47
48 public function getLogId(): ?int
49 {
50 return $this->logId;
51 }
52
53 protected function shouldLog(): bool
54 {
55 $logOptions = LoggerManager::getInstance()->getFilterOptions();
56
57 return !((isset($logOptions['client_id'], $this->context['CLIENT_ID']) && ($this->context['CLIENT_ID'] !== $logOptions['client_id']))
58 || (isset($logOptions['password_id'], $this->context['PASSWORD_ID']) && ($this->context['PASSWORD_ID'] !== $logOptions['password_id']))
59 || (isset($logOptions['scope'], $this->context['SCOPE']) && ($this->context['SCOPE'] !== $logOptions['scope']))
60 || (isset($logOptions['method'], $this->context['METHOD']) && ($this->context['METHOD'] !== $logOptions['method']))
61 || (isset($logOptions['user_id']) && CurrentUser::get()->getId() !== $logOptions['user_id']));
62 }
63}
string $message
Определения logger.php:36
array $context
Определения logger.php:35
$level
Определения logger.php:30
Определения log.php:39
static filterResponseData(&$data)
Определения log.php:158
logMessage(string $level, string $message)
Определения DataBaseLogger.php:17
log($level, \Stringable|string $message, array $context=[])
Определения DataBaseLogger.php:41
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14