ErrorHandler
in package
Error handler for the framework.
These will be depend on configuration in config/[environment]/app.php.
If the configuration 'log.enable' was not set to true
then it will be use error_log
on php.ini setting.
If the configuration 'log.enable' was set to true
then it will be set PHP error log path to inside storage/logs.
If the configuration 'log.donotLogLevel' was set then the it will be check for current error level must be matched and then set the ini log_errors
to true
or false
depend on matched or not.
If the configuration 'log.donotLogLevel' was not set then it will be use log_errors
on php.ini setting.
Tags
Table of Contents
Properties
- $Config : Config
- $Container : Container
- $donotLogLevel : int
Methods
- __construct() : mixed
- The class constructor.
- changeLogErrorsIniSetting() : bool
- Change `log_errors` in the php.ini depend on `log.donotLogLevel` in config/[environment]/app.php file.
- init() : string|null
- Initialize the error handler.
Properties
$Config
protected
Config
$Config
$Container
protected
Container
$Container
$donotLogLevel
protected
int
$donotLogLevel
Do not log when log level is UNDER selected. (read more in config/default/app.php.)
Methods
__construct()
The class constructor.
public
__construct(Container $Container) : mixed
Parameters
- $Container : Container
-
The DI container class.
changeLogErrorsIniSetting()
Change `log_errors` in the php.ini depend on `log.donotLogLevel` in config/[environment]/app.php file.
public
changeLogErrorsIniSetting(int $errno, string $errstr, string|null $errfile, int|null $errline) : bool
Parameters
- $errno : int
-
The first parameter,
errno
, will be passed the level of the error raised, as an integer. - $errstr : string
-
The second parameter,
errstr
, will be passed the error message, as a string. - $errfile : string|null
-
If the callback accepts a third parameter,
errfile
, it will be passed the filename that the error was raised in, as a string. - $errline : int|null
-
If the callback accepts a fourth parameter,
errline
, it will be passed the line number where the error was raised, as an integer.
Tags
Return values
bool —If the function returns false
then the normal error handler continues.
init()
Initialize the error handler.
public
init([string|null $response = '' ]) : string|null
Please read the class doc block.
Parameters
- $response : string|null = ''