mindscapehq / raygun-cake
一个用于将错误和异常发送到 Raygun.io 服务的 CakePHP 2.x 插件
v1.0.0
2018-11-27 20:01 UTC
Requires
- php: >=5.3.0
- mindscape/raygun4php: >=1.5.0
This package is auto-updated.
Last update: 2024-09-05 10:50:52 UTC
README
一个用于使用 Raygun.com 处理错误和异常的 CakePHP 插件。需要 PHP 5.3+(由于 Raygun4php 依赖)
基于 https://github.com/morrislaptop/AirbrakeCake
依赖项
- CakePHP 2.x
- Raygun4php,已打包在 /Vendor
安装
git submodule add git://github.com/MindscapeHQ/RaygunCake.git app/Plugin/RaygunCake
cd app/Plugin/RaygunCake
git submodule init
git submodule update
app/Config/bootstrap.php
<?php // Include our awesome error catcher.. CakePlugin::load('RaygunCake'); Configure::write('RaygunCake.apiKey', '<API KEY>'); // Optional: Send your application's version number Configure::write('RaygunCake.version', '1.2.3.4'); // Optional: Filter out sensitive parameters before logging to Raygun Configure::write('RaygunCake.filterParams', array('password' => true)); App::uses('RaygunError', 'RaygunCake.Lib');
app/Config/core.php
<?php Configure::write('Error', array( 'handler' => 'RaygunError::handleError', 'level' => E_ALL & ~E_DEPRECATED, 'trace' => true )); Configure::write('Exception', array( 'handler' => 'RaygunError::handleException', 'renderer' => 'ExceptionRenderer', 'log' => true ));
手动在 Raygun 中注册错误
<?php // Only the first 2 arguments are required RaygunError::handleErrorRaygun( E_WARNING, "Generic Description", $file, $line, $tags, $userCustomData, $timestamp );
手动在 Raygun 中注册异常
<?php // Only the first argument is required RaygunError::handleExceptionRaygun( $exception, $tags, $userCustomData, $timestamp );