<!-- wp:heading {"level":5} -->
<h5>这里用到了一个国外第三方的日志分析平台(sentry)</h5>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>官方网站网址: sentry网址</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":5} -->
<h5>下面我们去github去下载yii2-sentry组件</h5>
<!-- /wp:heading -->
<!-- wp:heading {"level":5} -->
<h5>选择一个stars较多的并且目前还在更新维护中的。</h5>
<!-- /wp:heading -->
<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"></figure>
<!-- /wp:image -->
<!-- wp:heading {"level":5} -->
<h5>然后去下载安装到自己框架中(这里不多介绍)</h5>
<!-- /wp:heading -->
<!-- wp:heading {"level":5} -->
<h5>主要看一下如何配置对接。</h5>
<!-- /wp:heading -->
<!-- wp:heading {"level":5} -->
<h5>点击自行注册登入(邮箱注册)</h5>
<!-- /wp:heading -->
<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"></figure>
<!-- /wp:image -->
<!-- wp:heading {"level":5} -->
<h5>创建项目</h5>
<!-- /wp:heading -->
<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"></figure>
<!-- /wp:image -->
<!-- wp:heading {"level":5} -->
<h5>选择你的编程语言</h5>
<!-- /wp:heading -->
<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"></figure>
<!-- /wp:image -->
<!-- wp:heading {"level":5} -->
<h5>拿到key</h5>
<!-- /wp:heading -->
<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"></figure>
<!-- /wp:image -->
<!-- wp:heading {"level":5} -->
<h5>去Yii2的配置文件,配置如下,可以参考。</h5>
<!-- /wp:heading -->
<!-- wp:code -->
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
// [
// 'class' => 'yiilogFileTarget',
// 'levels' => ['trace'],
// 'logFile' => '@app/runtime/logs/shop/trace.log',
// 'logVars' => ['_COOKIE'],
// 'categories' => ['mylog'],
// 'logVars' => [],
// ],
// [
// 'class' => 'yiilogEmailTarget',
// 'mailer' => 'mailer',
// 'levels' => ['trace'],
// 'categories' => ['mylog'],
// 'message' => [
// 'from' => ['17521181230@163.com'],
// 'to' => ['17521181230@163.com'],
// 'subject' => 'this is trace log',
// ],
// ],
[
'class' => 'notamediasentrySentryTarget',
'dsn' => 'https://e45054180b01821d72e26b8a2@sentry.io/1440272',
'levels' => ['error'],
'logVars' => [],
'context' => true // Write the context information. The default is true.
],
],
<!-- /wp:code -->
<!-- wp:heading {"level":5} -->
<h5>配置了错误等级和key,然后就可以了。</h5>
<!-- /wp:heading -->
<!-- wp:heading {"level":5} -->
<h5>效果如下:</h5>
<!-- /wp:heading -->
<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"></figure>
<!-- /wp:image -->
Comment here is closed