https://github.com/joy2fun/laravel-log-publish
Logging to a Redis channel for Laravel
https://github.com/joy2fun/laravel-log-publish
burn-after-reading laravel logging pubsub redis
Last synced: 5 months ago
JSON representation
Logging to a Redis channel for Laravel
- Host: GitHub
- URL: https://github.com/joy2fun/laravel-log-publish
- Owner: joy2fun
- Created: 2018-10-10T03:09:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-11T07:17:58.000Z (over 7 years ago)
- Last Synced: 2025-08-05T04:47:26.506Z (11 months ago)
- Topics: burn-after-reading, laravel, logging, pubsub, redis
- Language: PHP
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Logging to Redis channel for Laravel
## Installation
```sh
composer require joy2fun/laravel-log-pub
```
## Configuration
Add a custom logger channel to `config/logging.php` :
```
'pub' => [
'driver' => 'custom',
'via' => \Joy2fun\RedisPubLogger\Logger::class
],
```
Logging to configured channel:
```php
Log::channel("pub")->debug("dummy");
```
## Subscribe Redis channel
```sh
php artisan redis:subscribe
```
## More options
```php
[
// ...
'pub' => [
'driver' => 'custom',
'via' => \Joy2fun\RedisPubLogger\Logger::class,
'with' => [
'connection' => 'default', // redis connection
'quiet' => false, // "true" to ignore redis connection exception. default is "false"
'max_trace_length' => 1024, // truncated stacktrace string. set it to "0" to exclude trace from log
'format' => "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n",
]
]
]
```