krysvac / clogger
A class that logs your errors to files
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:logger
This package is not auto-updated.
Last update: 2024-09-12 00:25:28 UTC
README
A simple class that logs your errors to files.
How to install
This repo is avaiable through packagist with the command:
composer require krysvac/clogger
How to use
You will need to call these static functions to initialize the class.
// A folder called 'log' will be created in your output folder. // This is where all the files will be created in. CLogger::setOutputDir("/path/to/your/output/folder"); // Initializes class CLogger::init();
This CLogger class uses set_error_handler() to write the errors on the file. It's recommended to initialize the class as early as possible
Once initialized, all errors will be written to a file To trigger an error use trigger_error().
trigger_error("This is a warning!", E_USER_WARNING);
Also note that this function will not use error_reporting() to set which errors to display, instead you need to set it yourself.
Example:
error_reporting(E_ALL); CLogger::init();
License
This code is open-sourced software licensed under the MIT license.