\rex_logger

Simple Logger class.

Summary

Methods
Properties
Constants
setFactoryClass()
getFactoryClass()
hasFactoryClass()
getPath()
logException()
logError()
log()
open()
close()
getLogLevel()
factory()
No public properties found
No constants found
callFactoryClass()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

setFactoryClass()

setFactoryClass(string  $subclass) : mixed

Sets the class for the factory.

Parameters

string $subclass

Classname

Throws

\InvalidArgumentException

Returns

mixed —

getFactoryClass()

getFactoryClass() : string

Returns the class for the factory.

Returns

string —

hasFactoryClass()

hasFactoryClass() : bool

Returns if the class has a custom factory class.

Returns

bool —

getPath()

getPath() : string

Returns the path to the system.log file.

Returns

string —

logException()

logException(\Throwable|\Exception  $exception) : mixed

Shorthand: Logs the given Exception.

Parameters

\Throwable|\Exception $exception

The Exception to log

Returns

mixed —

logError()

logError(int  $errno, string  $errstr, string  $errfile, int  $errline) : mixed

Shorthand: Logs a error message.

Parameters

int $errno

The error code to log, e.g. E_WARNING

string $errstr

The error message

string $errfile

The file in which the error occured

int $errline

The line of the file in which the error occured

Throws

\InvalidArgumentException

Returns

mixed —

log()

log(mixed  $level, string  $message, array  $context = [], string  $file = null, int  $line = null) : mixed

Logs with an arbitrary level.

Parameters

mixed $level

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

string $message
array $context
string $file
int $line

Throws

\InvalidArgumentException

Returns

mixed —

open()

open() : mixed

Prepares the logifle for later use.

Returns

mixed —

close()

close() : mixed

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

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

Returns

mixed —

getLogLevel()

getLogLevel(int  $errno) : string

Map php error codes to PSR3 error levels.

Parameters

int $errno

a php error code, e.g. E_ERROR

Returns

string —

factory()

factory() : self

Returns

self —

callFactoryClass()

callFactoryClass(string  $method, array  $arguments) : mixed

Calls the factory class with the given method and arguments.

Parameters

string $method

Method name

array $arguments

Array of arguments

Returns

mixed —

Result of the callback