https://github.com/brainbits/monolog-sentry
Opiniated factory for bgalati/monolog-sentry-handler.
https://github.com/brainbits/monolog-sentry
Last synced: 12 months ago
JSON representation
Opiniated factory for bgalati/monolog-sentry-handler.
- Host: GitHub
- URL: https://github.com/brainbits/monolog-sentry
- Owner: brainbits
- Created: 2022-08-04T11:51:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-27T16:41:04.000Z (about 1 year ago)
- Last Synced: 2025-03-27T17:39:39.836Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
brainbits/monolog-sentry
========================
This package provides a opiniated factory for bgalati/monolog-sentry-handler, based on the provided [symfony guide](https://github.com/B-Galati/monolog-sentry-handler/blob/main/doc/guide-symfony.md).
Required configuration:
```yaml
# brainbits_monolog_sentry.yaml
parameters:
env(SENTRY_DSN): ''
env(SENTRY_ENVIRONMENT): ''
services:
_defaults:
autowire: true
autoconfigure: true
Brainbits\MonologSentry\SentryFactory: ~
Sentry\State\HubInterface:
factory: ['@Brainbits\MonologSentry\SentryFactory', 'create']
arguments:
$dsn: '%env(SENTRY_DSN)%'
$environment: '%env(SENTRY_ENVIRONMENT)%'
$inAppInclude: ['%kernel.project_dir%/src']
$inAppExclude: ['%kernel.cache_dir%', '%kernel.project_dir%/vendor']
$prefixes: ['%kernel.project_dir%']
$release: 'web-%app_version%'
$tags:
foo: bar
$logger: '@logger'
Controlling\Sentry\Sentry\SentryHandler: ~
Controlling\Sentry\EventListener\SentryConsoleListener: ~
Controlling\Sentry\EventListener\SentryRequestListener:
Controlling\Sentry\EventListener\SentryUserListener:
Controlling\Sentry\EventListener\MonologResetterEventListener: ~
```
Example monolog configuration:
```yaml
# monolog.yaml
when@prod:
monolog:
handlers:
sentry:
type: fingers_crossed
process_psr_3_messages: true
action_level: warning
handler: sentry_buffer
excluded_http_codes: [400, 401, 403, 404, 405]
buffer_size: 100 # Prevents memory leaks for workers
channels: ["!event", "!security"]
sentry_buffer:
type: buffer
handler: sentry_handler
sentry_handler:
type: service
id: 'Brainbits\MonologSentry\SentryHandler'
```