1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Logger.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2;
4
5use Bitrix\Main\ErrorCollection;
6use Bitrix\Main\Web\Json;
7
8class Logger
9{
10 private const MODULE = 'im';
11 private const TRACE_DEPTH = 10;
12
13 private string $uniqueString;
14
15 public function __construct(string $uniqueString)
16 {
17 $this->uniqueString = $uniqueString;
18 }
19
20 public function log(string $text): void
21 {
22 $text = 'unique-string: ' . $this->uniqueString . "\n" . $text;
23 AddMessage2Log($text, self::MODULE, self::TRACE_DEPTH);
24 }
25
26 public function logArray(array $array): void
27 {
28 $text = Json::encode($array);
29 $this->log($text);
30 }
31
32 public function logThrowable(\Throwable $throwable): void
33 {
34 $array = [
35 'type' => 'exception',
36 'message' => $throwable->getMessage(),
37 'code' => $throwable->getCode(),
38 'trace' => $throwable->getTraceAsString(),
39 ];
40 $this->logArray($array);
41 }
42
43 public function logErrors(ErrorCollection $errors): void
44 {
45 $array = [];
46
48 foreach ($errors as $error)
49 {
50 $array[] = [
51 'type' => 'error',
52 'message' => $error->getMessage(),
53 'code' => $error->getCode(),
54 'customData' => $error->getCustomData(),
55 ];
56 }
57
58 $this->logArray($array);
59 }
60}
log(string $text)
Определения Logger.php:20
__construct(string $uniqueString)
Определения Logger.php:15
logThrowable(\Throwable $throwable)
Определения Logger.php:32
logArray(array $array)
Определения Logger.php:26
log($level, string|\Stringable $message, array $context=[])
Определения logger.php:48
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$errors
Определения iblock_catalog_edit.php:74
AddMessage2Log($text, $module='', $traceDepth=6, $showArgs=false)
Определения tools.php:3941
$text
Определения template_pdf.php:79
$error
Определения subscription_card_product.php:20