jeetenkumarsingh / laravel-log-action-to-mysql
Laravel 的数据库日志驱动
dev-main
2023-07-21 09:19 UTC
Requires
- php: ^7.3
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^5.0
- orchestra/testbench: ^6.0
- pestphp/pest: ^1.0
- pestphp/pest-plugin-laravel: ^1.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-21 12:17:05 UTC
README
此包提供了一种将日志消息存储到数据库中的驱动程序。
在 Laravel 8 上进行了测试。
use Illuminate\Support\Facades\Log; Log::channel('db')->info('Your message');
安装
您可以通过 composer 安装此包
composer require jeetenkumarsingh/laravel-log-action-to-mysql
您可以使用以下命令发布并运行迁移
php artisan vendor:publish --tag="log-db-migrations"
php artisan migrate
现在向 config/logging.php
中添加一个新的频道。
use Jeter\LaravelLogDb\DatabaseLogger; return [ 'channels' => [ 'db' => [ 'driver' => 'custom', 'via' => DatabaseLogger::class, ], ] ]
用法
您可以将 db
频道添加到 stack
频道,然后按常规方式记录。
您还可以明确地将日志记录到数据库
use Illuminate\Support\Facades\Log; Log::channel('db')->info('Your message');
更新日志
有关最近更改的更多信息,请参阅 CHANGELOG。
贡献
有关详细信息,请参阅 CONTRIBUTING。
鸣谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。