Error handler and logger

Maintainers

Details

github.com/Yohn/E

Source

Issues

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

0.1.1 2024-11-22 11:33 UTC

This package is auto-updated.

Last update: 2025-02-22 12:15:01 UTC


README

An internal error handler and error logger.

Yohns\Core\E

include 'vendor/autoload.php';

use Yohns\Core\E;

E::initiate([
	// the directory to store the error logs in.
	'dir' => __DIR__.'/logs',
	// default to display the errors
	'display' => true,
	// what variables to store
	'store' => [
		// if any $_POST variable is set
		'_POST',
		// if any $_FILES variable is set
		'_FILES',
		// if any $_GET variable is set
		'_GET',
		// if any $_COOKIE variable is set, default this is not saved
		//'_COOKIE',
		// if any $_SESSION variable is set, default this is not saved
		//'_SESSION'
	],
]);

set_error_handler('Yohns\Core\E::errHandler');
set_exception_handler('Yohns\Core\E::excHandler');

Yohns\Core\Err

include 'vendor/autoload.php';

use Yohns\Core\Err;

try {
	throw new Err("This is a custom error message.");
} catch (Err $e) {
	echo $e->getDetailedMessage();
}