1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Log.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Log
;
4
5
use
Bitrix\Main\Loader
;
6
use Exception;
7
8
class
Log
9
{
10
public
const
DEFAULT_MARKER
=
'DEBUG_TASKS'
;
11
12
private
$marker;
13
private
$currentPortal =
''
;
14
private
$portals = [];
15
16
public
function
__construct
(
string
$marker = self::DEFAULT_MARKER)
17
{
18
$this->marker = $marker;
19
}
20
25
public
function
collect
(
$data
): self
26
{
27
try
28
{
29
if
(!Loader::includeModule(
'intranet'
))
30
{
31
return
$this;
32
}
33
34
$this->currentPortal = \CIntranetUtils::getHostName();
35
36
$this->checkPortal() && $this->save(
$data
);
37
}
38
catch
(Exception)
39
{
40
return
$this;
41
}
42
return
$this;
43
}
44
45
private
function
checkPortal(): bool
46
{
47
if
(!$this->currentPortal)
48
{
49
return
true
;
50
}
51
52
if
(empty($this->portals))
53
{
54
return
true
;
55
}
56
57
return
in_array($this->currentPortal, $this->portals);
58
}
59
60
private
function
save(
$data
): void
61
{
62
if
(!is_scalar(
$data
))
63
{
64
$data
= var_export(
$data
,
true
);
65
}
66
67
$message
= [$this->marker];
68
$message
[] =
$data
;
69
$message
= implode(
"\n"
,
$message
);
70
71
AddMessage2Log
(
$message
,
'socialnetwork'
);
72
}
73
}
Bitrix\Main\Loader
Определения
loader.php:13
Bitrix\Socialnetwork\Log\Log
Определения
Log.php:9
Bitrix\Socialnetwork\Log\Log\__construct
__construct(string $marker=self::DEFAULT_MARKER)
Определения
Log.php:16
Bitrix\Socialnetwork\Log\Log\DEFAULT_MARKER
const DEFAULT_MARKER
Определения
Log.php:10
Bitrix\Socialnetwork\Log\Log\collect
collect($data)
Определения
Log.php:25
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
AddMessage2Log
AddMessage2Log($text, $module='', $traceDepth=6, $showArgs=false)
Определения
tools.php:3941
Bitrix\Socialnetwork\Log
Определения
Log.php:3
$message
$message
Определения
payment.php:8
bitrix
modules
socialnetwork
lib
Log
Log.php
Создано системой
1.14.0