prinx / notify
Simple log package
v0.1.0
2021-04-30 13:56 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- nunomaduro/collision: ^5.1
- phpunit/phpunit: ^9.2.5
README
PHP Notify
Simple log package.Installation
composer require prinx/notify
Usage
$logger = new Log($file); $logger->info('User 1 has logged in.');
Log Levels
- debug
- info
- notice
- warning
- error
- critical
- alert
- emergency
Each log level corresponds to a method to log a message at that level.
$logger->debug('Debug level event has happened.'); $logger->info('Info level event has happened.'); $logger->notice('Notice level event has happened.'); $logger->warning('Warning level event has happened.'); $logger->error('Error level event has happened.'); $logger->critical('Critical level event has happened.'); $logger->alert('Alert level event has happened.'); $logger->emergency('Emergency level event has happened.');
Set another log file
$logger->setFile('path/to/log/file');
Remove log file
$logger->remove();
Fluent interface
The package implements the Fluent interface, allowing you to chain the methods of the logger.
// Eg: $logger->info('User logged in') ->setFile('error.log') ->error('An error happened.');
Running tests
vendor/bin/phpunit
Contribute
The package supports only files. It will be nice to add other log dirvers.
Apart from that, feel free to create a pull request with a new functionality to the package.