confetticode / laravel-logging
Integrate multi log channels with Laravel
v0.2.0
2023-08-27 23:48 UTC
Requires
- php: ^8.0
- ext-intl: *
- illuminate/log: ^10.0
- illuminate/support: ^10.0
- monolog/monolog: ^3.4
- tijsverkoyen/css-to-inline-styles: ^2.2
Requires (Dev)
- phpunit/phpunit: ^9.5 | ^10.0
- symfony/var-dumper: ^6.3
This package is auto-updated.
Last update: 2024-04-28 01:19:10 UTC
README
Installation
You can install the package via composer:
composer require confetticode/laravel-logging
Configure your expected channel variables:
LOG_MAIL_DRIVER=smtp
LOG_MAIL_LEVEL=error
LOG_MAIL_FROM=noreply@example.com
LOG_MAIL_TO=devops@example.com
LOG_TELEGRAM_LEVEL=error
LOG_TELEGRAM_API_KEY=1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LOG_TELEGRAM_CHAT_ID="@channel_or_group_id"
Usage
Send a log entry to mail or telegram:
# Sending a log entry via mail. Log::channel('mail')->info('Test mail log channel.'); # Sending a log entry via telegram. Log::channel('telegram')->info('Test telegram log channel.');
Or update the log stack to include telegram and mail channel:
<?php // config/logging.php return [ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['daily', 'telegram', 'mail'], 'ignore_exceptions' => false, ], ], ];
Contributing
- Clone the repository from GitHub.
- Checkout a new branch.
- Install composer dependencies and run tests first.
composer install composer run test
- Make any changes that you need and run test again.
- Finally, submit your pull request.
License (MIT)
The MIT License (MIT). Please see License File for more information.