1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Logger.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2;
4
5
use Bitrix\Main\ErrorCollection;
6
use Bitrix\Main\Web\Json;
7
8
class
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
}
Bitrix\Im\V2\Logger\log
log(string $text)
Определения
Logger.php:20
Bitrix\Im\V2\Logger\__construct
__construct(string $uniqueString)
Определения
Logger.php:15
Bitrix\Im\V2\Logger\logThrowable
logThrowable(\Throwable $throwable)
Определения
Logger.php:32
Bitrix\Im\V2\Logger\logArray
logArray(array $array)
Определения
Logger.php:26
Bitrix\Main\Diag\Logger
Определения
logger.php:18
Bitrix\Main\Diag\Logger\log
log($level, string|\Stringable $message, array $context=[])
Определения
logger.php:48
Bitrix\Main\ErrorCollection
Определения
errorcollection.php:14
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$errors
$errors
Определения
iblock_catalog_edit.php:74
AddMessage2Log
AddMessage2Log($text, $module='', $traceDepth=6, $showArgs=false)
Определения
tools.php:3941
$text
$text
Определения
template_pdf.php:79
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
im
lib
V2
Logger.php
Создано системой
1.14.0