Setup monolog channels

This commit is contained in:
Charles 2025-12-01 13:44:53 +01:00
parent d8934e2cf5
commit 1d8a4a7215
1 changed files with 60 additions and 18 deletions

View File

@ -1,5 +1,12 @@
monolog: monolog:
channels: channels:
- user_management
- authentication
- organization_management
- access_control
- email_notifications
- admin_actions
- security
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
when@dev: when@dev:
@ -40,23 +47,58 @@ when@test:
when@prod: when@prod:
monolog: monolog:
handlers: handlers:
main: # User Management
type: fingers_crossed user_management:
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream type: stream
path: php://stderr path: "%kernel.logs_dir%/user_management.log"
level: debug level: info
channels: [user_management]
formatter: monolog.formatter.json formatter: monolog.formatter.json
console:
type: console # Authentication
process_psr_3_messages: false authentication:
channels: ["!event", "!doctrine"]
deprecation:
type: stream type: stream
channels: [deprecation] path: "%kernel.logs_dir%/authentication.log"
path: php://stderr level: info
channels: [authentication]
formatter: monolog.formatter.json
# Organization Management
organization_management:
type: stream
path: "%kernel.logs_dir%/organization_management.log"
level: info
channels: [organization_management]
formatter: monolog.formatter.json
# Access Control
access_control:
type: stream
path: "%kernel.logs_dir%/access_control.log"
level: info
channels: [access_control]
formatter: monolog.formatter.json
# Email Notifications
email_notifications:
type: stream
path: "%kernel.logs_dir%/email_notifications.log"
level: info
channels: [email_notifications]
formatter: monolog.formatter.json
# Admin Actions
admin_actions:
type: stream
path: "%kernel.logs_dir%/admin_actions.log"
level: info
channels: [admin_actions]
formatter: monolog.formatter.json
# Security
security:
type: stream
path: "%kernel.logs_dir%/security.log"
level: warning
channels: [security]
formatter: monolog.formatter.json formatter: monolog.formatter.json