pstaender / silverstripe-sentry
Sentry Logging for SilverStripe
Installs: 782
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 0
Open Issues: 1
Type:silverstripe-vendormodule
Requires
This package is auto-updated.
Last update: 2024-12-18 15:26:41 UTC
README
First install the module in your SilverStripe 4.x project:
$ composer require pstaender/silverstripe-sentry dev-master
Activate and setup Sentry logging in the config file of your project. Replace the example dsn https://…:…@sentry.myserver.com/1
with your Sentry project 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
Use other formatter
Just override the 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'
Do everything by yourself via injection
You can skip installing this module by installing the sentry-client:
$ composer require sentry/sentry "*"
and modifying your project config:
--- 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