Bitrix API

RequestLogger extends Logger

Table of Contents

Methods

__construct()  : mixed
create()  : static|null
Creates a logger by its ID based on .settings.php.
enable()  : void
isEnabled()  : bool
log()  : void
setFormatter()  : $this
Sets a formatter for the logger.
setLevel()  : $this
Sets the maximun verbose level of the logger.
write()  : void
this method for log data from sync request you should send params in context: - requestParams - url - method - statusCode - response - error

Methods

__construct()

public __construct(int $userId, string $serviceName) : mixed
Parameters
$userId : int
$serviceName : string

create()

Creates a logger by its ID based on .settings.php.

public static create(string $id[, array<string|int, mixed> $params = [] ]) : static|null

'loggers' => [ 'logger.id' => [ 'className' => 'name of the logger class', 'constructorParams' => [] OR closure, OR 'constructor' => function (...$param)}, OPTIONAL 'level' => 'verbose level', 'formatter' => 'id of formatter in service locator', ] ]

Parameters
$id : string

A logger ID.

$params : array<string|int, mixed> = []

An optional params to be passed to a closure in settings.

Return values
static|null

enable()

public static enable([int $ttl = 0 ]) : void
Parameters
$ttl : int = 0
Tags
throws
ArgumentOutOfRangeException

isEnabled()

public static isEnabled() : bool
Return values
bool

log()

public log(mixed $level, string|Stringable $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$level : mixed
$message : string|Stringable
$context : array<string|int, mixed> = []
Tags
inheritdoc

setLevel()

Sets the maximun verbose level of the logger.

public setLevel(string $level) : $this
Parameters
$level : string

One of LogLevel constants.

Return values
$this

write()

this method for log data from sync request you should send params in context: - requestParams - url - method - statusCode - response - error

public write(array<string|int, mixed> $context) : void
Parameters
$context : array<string|int, mixed>

{ requestParams: array, url: string, method: string, statusCode: string, response: string, error: string, host: string, }

Tags
throws
LoaderException

        
On this page

Search results