# A sample log configuration file for running applications. By default, this configuration splits up log messages to
# two destinations:
#    * Console: For log messages with level INFO and higher
#    * log/application.log: DEBUG-level logs and higher are logged into this file
#    * log/other.log: Third-party crates' messages will be logged here at 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 "application" that writes to a file with a custom pattern encoder
  application:
    kind: rolling_file
    path: "log/application.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 20mb
      roller:
        kind: fixed_window
        base: 1
        count: 10
        pattern: "log/application.{}.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/other.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 10mb
      roller:
        kind: fixed_window
        base: 1
        count: 5
        pattern: "log/other.{}.log"
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

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

loggers:
  # Route log events sent to the "minotari" logger to the "application" appender
  minotari:
    level: debug
    appenders:
      - application
    additive: false
  # Route log events sent to the "tari" logger to the "application" appender
  tari:
    level: debug
    appenders:
      - application
    additive: false
  # Route log events sent to the "wallet" logger to the "application" appender
  wallet:
    level: debug
    appenders:
      - application
    additive: false
  # Route log events sent to third-party crates to the "other" appender
  rustyline:
    level: warn
    appenders:
      - other
    additive: false
  tokio_util:
    level: warn
    appenders:
      - other
    additive: false
