monolog:
  channels: [ 'upgrade', 'install', 'auth', 'deprecation', 'security' ]
  handlers:
    upgrade:
      type: stream
      path: "%env(default:base.log.dir:env.base_logs:LOG_DIR)%/upgrade.log"
      level: debug
      channels: [ "upgrade" ]
    install:
      type: stream
      path: "%env(default:base.log.dir:env.base_logs:LOG_DIR)%/install.log"
      level: debug
      channels: [ "install" ]
    auth:
      type: stream
      path: "%env(default:log.dir:env.logs:LOG_DIR)%/auth.log"
      level: debug
      channels: [ "auth" ]
    main:
      type: stream
      path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.main.default:MAIN_LOG_FILE_NAME)%"
      level: '%env(MAIN_LOG_LEVEL)%'
      channels: [ "!event", "!upgrade" ]
      # uncomment to get logging in your browser
      # you may have to allow bigger header sizes in your Web server configuration
      #firephp:
      #    type: firephp
      #    level: info
      #chromephp:
      #    type: chromephp
      #    level: info
    console:
      type: console
      process_psr_3_messages: false
      channels: [ "!event", "!doctrine", "!console", "!upgrade" ]

    deprecation:
      type: stream
      path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.deprecation.default:DEPRECATION_LOG_FILE_NAME)%"
      level: '%env(DEPRECATION_LOG_LEVEL)%'
      max_level: error
      channels: [ "deprecation" ]

    security:
      type: stream
      path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.security.default:SECURITY_LOG_FILE_NAME)%"
      level: '%env(SECURITY_LOG_LEVEL)%'
      max_level: error
      channels: [ "security" ]

    messenger:
      type: stream
      path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.messenger.default:MESSENGER_LOG_FILE_NAME)%"
      level: '%env(MESSENGER_LOG_LEVEL)%'
      channels: [ "messenger" ]

when@test:
  monolog:
    handlers:
      main:
        type: fingers_crossed
        action_level: error
        handler: nested
        excluded_http_codes: [404, 405]
        channels: ["!event"]
      nested:
        type: stream
        path: "%kernel.logs_dir%/%kernel.environment%.log"
        level: debug

when@prod:
  monolog:
    handlers:
      main:
        type: fingers_crossed
        action_level: info
        handler: nested
        excluded_http_codes: [404, 405]
        # Prevents memory leaks
        buffer_size:  50
        channels: ["!event","!upgrade", "!deprecation", "!security", "!messenger"]
      nested:
        type: stream
        path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.main.default:MAIN_LOG_FILE_NAME)%"
        level: '%env(MAIN_LOG_LEVEL)%'
        channels: ["!event", "!upgrade", "!deprecation", "!security", "!messenger"]
      console:
        type: console
        process_psr_3_messages: false
        level: warning
        action_level: info
        channels: ["!event", "!doctrine", "!upgrade", "!deprecation", "!messenger"]

      deprecation:
        type: stream
        path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.deprecation.default:DEPRECATION_LOG_FILE_NAME)%"
        level: '%env(DEPRECATION_LOG_LEVEL)%'
        max_level: error
        channels: [ "deprecation" ]

      security:
        type: stream
        path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.security.default:SECURITY_LOG_FILE_NAME)%"
        level: '%env(SECURITY_LOG_LEVEL)%'
        max_level: error
        channels: [ "security" ]

      messenger:
        type: stream
        path: "%env(default:log.dir:env.logs:LOG_DIR)%/%env(default:log.messenger.default:MESSENGER_LOG_FILE_NAME)%"
        level: '%env(MESSENGER_LOG_LEVEL)%'
        channels: [ "messenger" ]
