ebethus/laravel-mysql-log-driver
最新稳定版本:v1.0.7
Composer 安装命令:
composer require ebethus/laravel-mysql-log-driver
包简介
Laravel 10+ MySQL driver for Monolog
README 文档
README
This package will log errors into MySQL database instead storage/log/laravel.log file.
Installation
composer require itelmenko/laravel-mysql-logger
If you wish to change default table name to write the log into or database connection use following definitions in your .env file
DB_LOG_TABLE=logs
DB_LOG_CONNECTION=mysql
Publish config using Laravel Artisan CLI.
php artisan vendor:publish
Migrate tables.
php artisan migrate
Using
In config/logging.php
<?php // [...] 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['mysql'], ], // [...] 'mysql' => [ 'driver' => 'custom', 'via' => ITelmenko\Logger\Laravel\Logging\MySQLLogger::class, 'connection' => env('DB_LOG_CONNECTION'), 'table' => env('DB_LOG_TABLE'), 'name' => 'my.channel' // optional ], ],
Somewhere in your application
Log::channel('mysql')->info('Something happened!');
TODO
Change$table->bigIncrements('id')to something like ULIDChange root namespace toITelmenkoRemoveextrafields from modelRemove updated_at?Add microseconds for created_at- Update version and readme.md (about a changing of migration, about vendor:publish)
- Add
php doc - Add phpcs
统计信息
- 总下载量: 2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-19