Lizmap Web Client 3.11.0

Logger extends AbstractLogger
in package

Logger is an implementation of the PSR-3 Logger Interface.

This logger wraps \jLog with a log level.

Tags
author

3liz

see
https://www.php-fig.org/psr/psr-3/
see
https://jelix.org/documentation/jelix/1.8/api/jLog

Table of Contents

Constants

DefaultLevel  = \Psr\Log\LogLevel::ERROR
The default log level: error.
LogLevels  = array(\Psr\Log\LogLevel::EMERGENCY, \Psr\Log\LogLevel::ALERT, \Psr\Log\LogLevel::CRITICAL, \Psr\Log\LogLevel::ERROR, \Psr\Log\LogLevel::WARNING, \Psr\Log\LogLevel::NOTICE, \Psr\Log\LogLevel::INFO, \Psr\Log\LogLevel::DEBUG)
Levels ordered from most important to least important as defined in RFC 5424.

Properties

$level  : string
The minimum logging level at which this logger will be used.

Methods

__construct()  : mixed
Initialise the logger with a log level.
getLevel()  : string
Get log level.
isLevelHighEnough()  : bool
Check if the given level is high enough to be logged.
log()  : void
Logs with an arbitrary level.
setLevel()  : void
Set log level.
interpolate()  : string
Interpolates context values into message placeholders according to PSR-3 rules.

Constants

DefaultLevel

The default log level: error.

public string DefaultLevel = \Psr\Log\LogLevel::ERROR

LogLevels

Levels ordered from most important to least important as defined in RFC 5424.

public array<string|int, string> LogLevels = array(\Psr\Log\LogLevel::EMERGENCY, \Psr\Log\LogLevel::ALERT, \Psr\Log\LogLevel::CRITICAL, \Psr\Log\LogLevel::ERROR, \Psr\Log\LogLevel::WARNING, \Psr\Log\LogLevel::NOTICE, \Psr\Log\LogLevel::INFO, \Psr\Log\LogLevel::DEBUG)
Tags
see
LogLevel

Properties

$level

The minimum logging level at which this logger will be used.

protected string $level

Methods

__construct()

Initialise the logger with a log level.

public __construct([string $level = LogLevel::ERROR ]) : mixed
Parameters
$level : string = LogLevel::ERROR

The minimum logging level at which this logger will be used

Tags
throws
InvalidArgumentException
see
LogLevel
see
setLevel()
see
https://www.php-fig.org/psr/psr-3/#5-psrlogloglevel

getLevel()

Get log level.

public getLevel() : string
Return values
string

isLevelHighEnough()

Check if the given level is high enough to be logged.

public isLevelHighEnough(string $level) : bool

This is used to avoid unnecessary logging. For example, if the logger is set to LogLevel::ERROR, then LogLevel::INFO will not be logged. But LogLevel::ERROR will be logged. if the level is not in the list of LogLevels, it will be considered as not high enough.

Parameters
$level : string
Return values
bool

log()

Logs with an arbitrary level.

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

setLevel()

Set log level.

public setLevel(string $level) : void
Parameters
$level : string
Tags
throws
InvalidArgumentException

interpolate()

Interpolates context values into message placeholders according to PSR-3 rules.

private interpolate(string $message[, array<string|int, mixed> $context = array() ]) : string

This method replaces placeholders in the message with actual values from the context array.

Parameters
$message : string

Message with placeholders

$context : array<string|int, mixed> = array()

Values to replace placeholders

Tags
see
https://www.php-fig.org/psr/psr-3/#12-message
Return values
string

Interpolated message


        
On this page

Search results