parallax/cake-sentry

CakePHP Sentry 插件

安装量: 1,645

依赖项: 0

建议者: 0

安全性: 0

星星: 2

关注者: 20

分支: 16

类型:cakephp-plugin

dev-master 2014-10-14 12:45 UTC

This package is auto-updated.

Last update: 2024-08-30 01:20:01 UTC


README

Cake-Sentry 是一个连接到 Sentry - 文档 的错误处理器

安装

  1. 将 Sentry 插件安装到您的 CakePHP 项目中
	git submodule add http://github.com/Sandreu/cake-sentry app/Plugin/Sentry
	cd app/Plugin/Sentry
	git submodule init
	git submodule update
  1. 在您的 bootstrap.php 中加载 cake-sentry 插件
	CakePlugin::load('Sentry');
  1. 在您的 core.php 中配置错误处理器
	App::uses('SentryErrorHandler', 'Sentry.Lib');
	
	Configure::write('Sentry', array(
		'production_only' => false, // true is default value -> no error in sentry when debug
		'avoid_bot_scan_errors' => 'MissingController or MissingPlugin error message', // or false if you want Sentry to log MissingController and MissingPlugin Exceptions
		'User' => array(
			'model' => 'SpecialUser', // 'User' is default value
			'email_field' => 'special_email' // default checks 'email' and 'mail' fields
		),
		'PHP' => array(
			'server'=>'http://your-sentry-dns-for-PHP'
		),
		'javascript' => array(
			'server'=>'http://your-sentry-dns-for-javascript'
		)
	));

	Configure::write('Error', array(
		'handler' => 'SentryErrorHandler::handleError',
		'level' => E_ALL & ~E_DEPRECATED,
		'trace' => true
	));

	Configure::write('Exception', array(
		'handler' => 'SentryErrorHandler::handleException',
		'renderer'=>'ExceptionRenderer'
	));
  1. 使用 Sentry 作为日志记录器
	CakeLog::config('default', array('engine' => 'Sentry.SentryLog'));
  1. 在默认布局中包含 ravenjs 和初始化脚本
	<?php
	echo $this->Html->script('jquery');
	echo $this->Html->script('ravenjs-min');
	?>
	<script type="text/javascript">
		$(function () {
			<?php echo $this->element('Sentry.raven-js'); ?>
		});
	</script>