DatabaseLogger extends Logger implements Logger
FinalYes
Table of Contents
Interfaces
Methods
- create() : static|null
- Creates a logger by its ID based on .settings.php.
- log() : void
- logMessage() : void
- setFormatter() : $this
- Sets a formatter for the logger.
- setLevel() : $this
- Sets the maximun verbose level of the logger.
- write() : void
Methods
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|nulllog()
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
logMessage()
public
logMessage(string $level, string $message) : void
Parameters
- $level : string
- $message : string
setFormatter()
Sets a formatter for the logger.
public
setFormatter(LogFormatterInterface $formatter) : $this
Parameters
- $formatter : LogFormatterInterface
Return values
$thissetLevel()
Sets the maximun verbose level of the logger.
public
setLevel(string $level) : $this
Parameters
- $level : string
-
One of LogLevel constants.
Return values
$thiswrite()
public
write(array{message?: string, entityType?: string, entityId?: int, userId?: int} $context) : void
Parameters
- $context : array{message?: string, entityType?: string, entityId?: int, userId?: int}