monolog:
    channels:
        - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
        - apiErrors
        - apiLogs

when@dev:
    monolog:
        handlers:
            apiErrors:
                type: rotating_file
                path: '%kernel.logs_dir%/api_errors.%kernel.environment%.log'
                level: debug
                max_files: 10
                channels: ["apiErrors"]
            apiLogs:
                type: rotating_file
                path: '%kernel.logs_dir%/api_logs.%kernel.environment%.log'
                level: debug
                max_files: 10
                channels: ["apiLogs"]
            main:
                type: stream
                path: "%kernel.logs_dir%/%kernel.environment%.log"
                level: debug
                channels: ["!event", "!main", "!apiErrors", "!apiLogs"]

when@prod:
    monolog:
        handlers:
            apiErrors:
                type: rotating_file
                path:  "php://stdout"
                level: debug
                max_files: 10
                channels: [ "apiErrors", "apiLogs" ]
            main:
                type: fingers_crossed
                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
                path:  "php://stderr"
                level: debug
                formatter: monolog.formatter.json
                channels: ["!event", "!doctrine", "!apiErrors", "!apiLogs"]
            console:
                type: console
                process_psr_3_messages: false
                channels: ["!event", "!doctrine"]
            deprecation:
                type: stream
                channels: [deprecation]
                path: "%kernel.logs_dir%/%kernel.environment%.deprecation.log"
