Documentation

rex_logger extends AbstractLogger
in package
Uses rex_factory_trait

Simple Logger class.

Tags
author

staabm

Table of Contents

Methods

close()  : void
Closes the logfile. The logfile is not be able to log further message after beeing closed.
factory()  : self
getLogLevel()  : string
Map php error codes to PSR3 error levels.
getPath()  : string
Returns the path to the system.log file.
log()  : void
Logs with an arbitrary level.
logError()  : void
Shorthand: Logs a error message.
logException()  : void
Shorthand: Logs the given Exception.
open()  : void
Prepares the logifle for later use.

Methods

close()

Closes the logfile. The logfile is not be able to log further message after beeing closed.

public static close() : void

You dont need to close the logfile manually when it was registered during the request.

factory()

public static factory() : self
Return values
self

getLogLevel()

Map php error codes to PSR3 error levels.

public static getLogLevel(int $errno) : string
Parameters
$errno : int

a php error code, e.g. E_ERROR

Return values
string

getPath()

Returns the path to the system.log file.

public static getPath() : string
Return values
string

log()

Logs with an arbitrary level.

public log(mixed $level, string|Stringable $message[, array<string|int, mixed> $context = [] ][, string|null $file = null ][, int|null $line = null ][, string|null $url = null ]) : void
Parameters
$level : mixed

either one of LogLevel::* or also any other string

$message : string|Stringable
$context : array<string|int, mixed> = []
$file : string|null = null
$line : int|null = null
$url : string|null = null
Tags
throws
InvalidArgumentException

logError()

Shorthand: Logs a error message.

public static logError(int $errno, string $errstr, string $errfile, int $errline[, string|null $url = null ]) : void
Parameters
$errno : int

The error code to log, e.g. E_WARNING

$errstr : string

The error message

$errfile : string

The file in which the error occured

$errline : int

The line of the file in which the error occured

$url : string|null = null
Tags
throws
InvalidArgumentException

logException()

Shorthand: Logs the given Exception.

public static logException(Throwable|Exception $exception[, string|null $url = null ]) : void
Parameters
$exception : Throwable|Exception

The Exception to log

$url : string|null = null

open()

Prepares the logifle for later use.

public static open() : void
Tags
psalm-assert

!null self::$file


        
On this page

Search results