https://github.com/alaa-almaliki/laravel-log
Laravel Logging
https://github.com/alaa-almaliki/laravel-log
laravel logging
Last synced: 6 months ago
JSON representation
Laravel Logging
- Host: GitHub
- URL: https://github.com/alaa-almaliki/laravel-log
- Owner: alaa-almaliki
- License: mit
- Created: 2020-03-27T00:25:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-27T01:49:35.000Z (over 6 years ago)
- Last Synced: 2024-04-24T00:30:20.279Z (about 2 years ago)
- Topics: laravel, logging
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Log
## Existing Logs
Exception Log
```php
try {
throw new Exception('Test');
} catch (Exception $exception) {
\Enkidu\Log\Facades\ExceptionLogger::logException($exception); // exception.log
}
```
Debug Log
```php
\Enkidu\Log\Facades\DebugLogger::info('Test'); // debug.log
```
## Creating custom log
* Add logging channel in `config/logging.php`
```php
'channels' => [
...
'test' => [
'driver' => 'single',
'path' => storage_path('logs/test.log'),
'level' => 'info',
],
...
]
```
* Create custom logging class
```php
class TestLogger extends BaseLogger
{
/**
* @inheritDoc
*/
protected function getLoggingChannel(): string
{
return 'test';
}
}
```
How to use
```php
$test = new \App\Logger\TestLogger;
$test->info('Test'); // test.log
```