pstaender / silverstripe-sentry
Sentry 日志记录工具,适用于 SilverStripe
v0.1.1
2018-09-24 11:01 UTC
Requires
This package is auto-updated.
Last update: 2024-09-18 15:01:20 UTC
README
首先在您的 SilverStripe 4.x 项目中安装此模块
$ composer require pstaender/silverstripe-sentry dev-master
激活并设置项目配置文件中的 Sentry 日志记录。将示例 dsn https://…:…@sentry.myserver.com/1
替换为您自己的 Sentry 项目 dsn
--- Name: my-sentry-logging Only: environment: "live" --- SilverStripe\Core\Injector\Injector: Psr\Log\LoggerInterface: calls: LogFileHandler: [ pushHandler, [ '%$SentryLogHandler' ] ] RavenClient: constructor: - https://…:…@sentry.myserver.com/1
使用其他格式化器
只需覆盖 sentry-logging-config 即可
--- Name: sentry-logging Only: environment: "live" --- SilverStripe\Core\Injector\Injector: Psr\Log\LoggerInterface: calls: LogFileHandler: [ pushHandler, [ '%$SentryLogHandler' ] ] RavenClient: constructor: - https://…:…@…/18 --- Name: my-sentry-logging After: - '#sentry-logging' --- SilverStripe\Core\Injector\Injector: SentryLogHandler: properties: ContentType: application/json Formatter: '%$Monolog\Formatter\JsonFormatter'
通过注入自行完成所有操作
您可以通过安装 sentry-client 并修改项目配置来跳过安装此模块
$ composer require sentry/sentry "*"
--- Name: myproject --- SilverStripe\Core\Injector\Injector: Psr\Log\LoggerInterface: calls: LogFileHandler: [ pushHandler, [ '%$SentryLogHandler' ] ] SentryLogHandler: class: Monolog\Handler\RavenHandler constructor: - '%$RavenClient' properties: ContentType: text/html Formatter: '%$SentryLoggingFormatter' SentryLoggingFormatter: class: Monolog\Formatter\LineFormatter constructor: - '%message%' RavenClient: class: Raven_Client constructor: - https://…:…@sentry.myserver.com/1