errorstream / errorstream-yii2
ErrorStream.com 集成用 Yii 2 包
1.1
2016-06-16 02:44 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-14 19:36:59 UTC
README
为 Errorstream 提供 Yii2 集成
## 安装说明
首先,在终端运行以下命令以下载和安装包
composer require errorstream/errorstream-yii2
接下来,在 web.php 配置文件中注册客户端类。您可以在 errorstream.com 项目设置页面找到您的 API 令牌和项目令牌
'components' => [ ... 'errorstream' => [ 'class' => 'ErrorStream\ErrorStreamClient\ErrorStreamClient', 'api_token' => 'YOUR_API_TOKEN', //Put your api token here 'project_token' => 'YOUR_PROJECT_TOKEN', //Put your project token here 'active' => true, //You might want to only activate this in production mode ] ... ]
接下来,您需要编辑 web.php 配置文件中的 errorHandler 设置。您需要将 ErrorStreamErrorHandler 作为错误处理器的 'class' 放置,如下所示。
'components' => [ ... 'errorHandler' => [ 'errorAction' => 'site/error', 'class' => 'ErrorStream\ErrorStream\ErrorStreamErrorHandler', ], ... ]
最后,您需要编辑 web.php 配置文件中的 errorHandler 设置。您需要将 ErrorStreamErrorHandler 作为错误处理器的 'class' 放置,如下所示。
'components' => [ ... 'log' => [ .. 'targets' => [ ... [ 'class' => 'ErrorStream\ErrorStream\ErrorStreamLogger', 'levels' => ['error', 'warning'], //Only send errors and warnings. 'logVars' => [], //Necessary so you don't submit every request to our server. ], ... ], ] ]