Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prinx/notify
Simple log package
https://github.com/prinx/notify
Last synced: 15 days ago
JSON representation
Simple log package
- Host: GitHub
- URL: https://github.com/prinx/notify
- Owner: prinx
- License: mit
- Created: 2020-06-23T23:11:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-30T13:57:27.000Z (over 3 years ago)
- Last Synced: 2024-11-01T14:06:02.881Z (2 months ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple log package.## Installation
```shell
composer require prinx/notify
```## Usage
```php
$logger = new Log($file);
$logger->info('User 1 has logged in.');
```## Log Levels
- debug
- info
- notice
- warning
- error
- critical
- alert
- emergencyEach log level corresponds to a method to log a message at that level.
```php
$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
```php
$logger->setFile('path/to/log/file');
```## Remove log file
```php
$logger->remove();
```## Fluent interface
The package implements the Fluent interface, allowing you to chain the methods of the logger.
```php
// Eg:
$logger->info('User logged in')
->setFile('error.log')
->error('An error happened.');
```## Running tests
```shell
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.
## Licence
[MIT](LICENSE)