# A sample log configuration file for running in release mode. By default, this configuration splits up log messages to
# three destinations:
#    * Console: For log messages with level INFO and higher
#    * log/base-node/network.log: TRACE-level logs related to networking. This file will be quite busy since there
#      are lots of P2P debug messages, and so this traffic is segregated from the application log messages
#    * log/base-node/base_layer.log: Non-comms related TRACE-level messages and higher are logged into this file
#    * log/base-node/other.log: Third-party crates' messages will be logged here at an WARN level or higher
#
#  See https://docs.rs/log4rs/0.8.3/log4rs/encode/pattern/index.html for deciphering the log pattern. The log format
#  used in this sample configuration prints messages as:
#  timestamp [target] LEVEL message
refresh_rate: 30 seconds
appenders:
  # An appender named "stdout" that writes to stdout
  stdout:
    kind: console
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {h({l}):5} {m}{n}"

  # An appender named "network" that writes to a file with a custom pattern encoder
  network:
    kind: rolling_file
    path: "log/base-node/network.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 20mb
      roller:
        kind: fixed_window
        base: 1
        count: 10
        pattern: "log/base-node/network.{}.log"
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

  # An appender named "base_layer" that writes to a file with a custom pattern encoder
  base_layer:
    kind: rolling_file
    path: "log/base-node/base_layer.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 20mb
      roller:
        kind: fixed_window
        base: 1
        count: 10
        pattern: "log/base-node/base_layer.{}.log"
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

  # An appender named "other" that writes to a file with a custom pattern encoder
  other:
    kind: rolling_file
    path: "log/base-node/other.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 10mb
      roller:
        kind: fixed_window
        base: 1
        count: 5
        pattern: "log/base-node/other.{}.log"
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

  # An appender named "mm_proxy" that writes to a file with a custom pattern encoder
  mm_proxy:
    kind: rolling_file
    path: "log/base-node/mm_proxy.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 10mb
      roller:
        kind: fixed_window
        base: 1
        count: 10
        pattern: "log/base-node/mm_proxy.{}.log"
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

# Set the default logging level to "warn" and attach the "stdout" appender to the root
root:
  level: warn
  appenders:
    - stdout

loggers:
  # Route log events sent to the "core" logger to the "base_layer" appender
  c:
    level: debug
    appenders:
      - base_layer
    additive: false
  # Route log events sent to the "wallet" logger to the "base_layer" appender
  wallet:
    level: debug
    appenders:
      - base_layer
    additive: false
  # Route log events sent to the "comms" logger to the "network" appender
  comms:
    level: debug
    appenders:
      - network
    additive: false
  # Route log events sent to the "p2p" logger to the "network" appender
  p2p:
    level: trace
    appenders:
      - network
    additive: false
  # Route log events sent to the "yamux" logger to the "network" appender
  yamux:
    level: warn
    appenders:
      - network
    additive: false
  # Route log events sent to the "mio" logger to the "network" appender
  mio:
    level: warn
    appenders:
      - network
    additive: false
  # Route log events sent to the "rustyline" logger to the "other" appender
  rustyline:
    level: warn
    appenders:
      - other
    additive: false
  # Route log events sent to the "tokio_util" logger to the "other" appender
  tokio_util:
    level: warn
    appenders:
      - other
    additive: false
  # Route log events sent to the "minotari_mm_proxy" logger to the "mm_proxy" appender
  minotari_mm_proxy:
    level: debug
    appenders:
      - mm_proxy
    additive: false
