confetticode / laravel-log
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: 2025-02-19 06:26:14 UTC
README
Installation
You can install the package via composer:
composer require confetticode/laravel-log
Usage
Configure your environment variables:
LOG_MAIL_DRIVER=smtp
LOG_MAIL_LEVEL=error
LOG_MAIL_FROM=internal@confetticode.com
LOG_MAIL_TO=devops@confetticode.com
LOG_TELEGRAM_LEVEL=error
LOG_TELEGRAM_API_KEY=1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LOG_TELEGRAM_CHAT_ID="@channel_or_group_id"
Send a log entry to mail or telegram:
# Sending a log entry via mail. Log::channel('mail')->error('Test mail log channel.'); # Sending a log entry via telegram. Log::channel('telegram')->error('Test telegram log channel.');
You may want to update the config/logging.php
to push telegram and mail channels in the stack:
<?php return [ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['daily', 'telegram', 'mail'], 'ignore_exceptions' => false, ], ], ];
You may use mail
and telegram
log drivers however you want. Please read the logging.php to know about their configuration!
Contributing
Thank you for considering contributing to the ConfettiCode
project! The contribution guide can be found in the contributing documentation.
License (MIT)
The MIT License (MIT). Please see the License for more information.