inktrapdesign/model-logger
最新稳定版本:0.0.8
Composer 安装命令:
composer require inktrapdesign/model-logger
包简介
Logs model updates in better stack
README 文档
README
This package provides a simple way to log model changes in your Laravel application.
Installation
You can install the package via composer:
composer require inktrapdesign/model-logger
Setup
You need to the BetterStack Source to your environment file. This is the source that will be used to identify the log entries in BetterStack.
LOGGER_CHANNEL=default LOGGER_SOURCE=1234567890
Usage
To enable logging for a model, add the ModelLogger trait to the model
use InktrapDesign\ModelLogger\ModelLogger; class User extends Model { use ModelLogger; }
General Logging
To enable general logging to BetterStack, you first need to create a new channel in the config/logging.php file.
'betterstack' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => \Logtail\Monolog\LogtailHandler::class, 'with' => [ 'sourceToken' => env('LOGGER_SOURCE') ], 'processors' => [PsrLogMessageProcessor::class], ],
You then want to add this channel to the stack, also in the config/logging.php file.
'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'betterstack'], 'ignore_exceptions' => false, ],
统计信息
- 总下载量: 166
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-21