version: 1
disable_existing_loggers: False  # fixes issue with module level loggers

filters:
  # This filter is necessary to use the "%(level_char)s" format variable.
  level_char:
    (): mwcp.utils.logutil.LevelCharFilter

formatters:
  simple:
    format: "[%(level_char)s] (%(processName)s:%(name)s): %(message)s"
  error:
    format: "<PID %(process)d:%(processName)s> [%(name)s:%(funcName)s():%(lineno)d]: %(message)s"

handlers:
  console:
    class: logging.StreamHandler
    formatter: simple
    filters: [level_char]
    stream: ext://sys.stderr

  error_file:
    # Custom handler necessary to fix issues that can occur in Windows.
    (): mwcp.utils.logutil.MPRotatingFileHandler
    level: WARNING
    formatter: error
    filename: "errors.log"
    maxBytes: 10485760 # 10MB
    backupCount: 3
    encoding: utf8

  null_handler:
    class: logging.NullHandler

  mwcp_server:
    (): mwcp.utils.logutil.ListHandler
    level: INFO
    filters: [level_char]
    formatter: simple
    entries: 1000

root:
  level: INFO
  handlers: [console, error_file, mwcp_server]
