version: 1
disable_existing_loggers: false

formatters:
  default:
    "()": uvicorn.logging.DefaultFormatter
    fmt: "%(asctime)s | %(levelprefix)s %(name)s | %(message)s"
    use_colors: true

  access:
    "()": uvicorn.logging.AccessFormatter
    fmt: '%(asctime)s | %(client_addr)s - "%(request_line)s" %(status_code)s'
    use_colors: true

handlers:
  default:
    formatter: default
    class: logging.StreamHandler
    stream: ext://sys.stderr

  access:
    formatter: access
    class: logging.StreamHandler
    stream: ext://sys.stdout

  file:
    formatter: default
    class: logging.handlers.RotatingFileHandler
    filename: .nyahome/app.log
    maxBytes: 10485760
    backupCount: 5
    encoding: utf8

loggers:
  uvicorn:
    handlers: [ default, file ]
    level: INFO
    propagate: false

  uvicorn.error:
    handlers: [ default, file ]
    level: INFO
    propagate: false

  uvicorn.access:
    handlers: [ access, file ]
    level: INFO
    propagate: false

  nyahome:
    handlers: [ default, file ]
    level: DEBUG
    propagate: false