soyhuce/laravel-rollbar
Composer 安装命令:
composer require soyhuce/laravel-rollbar
包简介
Rollbar wrapper for Laravel
README 文档
README
Rollbar wrapper for Laravel
Installation
You can install the package via composer:
composer require soyhuce/laravel-rollbar
You can then add rollbar configuration in your config/logging.php
return [ //... 'channels' => [ 'rollbar' => [ 'driver' => 'monolog', 'handler' => \Soyhuce\LaravelRollbar\LaravelRollbarHandler::class, 'level' => env('LOG_LEVEL', 'error'), 'access_token' => env('ROLLBAR_SERVER_KEY'), ], ], ];
You can add the configurations you need. See the Rollbar documentation for more information.
Customizing current user resolution
You can customize the current user resolution
with \Soyhuce\LaravelRollbar\Facades\Rollbar::resolveAuthenticatedUserUsing(). You may want to add this in a service
provider (for example AppServiceProvider).
\Soyhuce\LaravelRollbar\Facades\Rollbar::resolveAuthenticatedUserUsing(function (): array { $user = auth()->user(); if ($user === null) { return []; } return [ 'id' => (string) $user->id, // id must be a string 'role' => $user->role->label, ]; });
A default user resolver is provided in this package.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 832
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-05