silverback/yii-google-cloud-error-reporting

此软件包最新版本(1.0.0)没有提供许可信息。

1.0.0 2018-07-05 07:38 UTC

This package is auto-updated.

Last update: 2024-08-26 21:29:01 UTC


README

安装

protected/extensions/yii-stackdriver 中克隆此仓库。

运行 composer update 以下载所需依赖。

配置

将日志路由添加到 CLogRouter 以将日志发送到 Google Cloud Logging。

'log'=>array(
	'class'=>'CLogRouter',
	'routes'=>array(
		array(
			'class'=>'ext.yii-stackdriver.StackdriverLogRoute',
			'levels'=>'error, warning, info, profile, debug',
			
			// override error severity for some exceptions
			'errorSeverity' => array(
				'exception.CHttpException.404' => 'info',
			)
		),
		...
	)
)

在配置中自定义错误处理的类。

'errorHandler'=>array(
	// use 'site/error' action to display errors
	'class'=>'ext.yii-stackdriver.StackdriverErrorHandler',
	'errorAction'=>'site/error',
	
	// do not consider 404 as errors/exceptions
	'skip404' => true,
),

使用以下权限授权 GCE VM 服务帐户:

  • 错误报告授权者
  • 日志授权者