<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <!-- Dev: human-readable console output -->
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %X{trace-id:-} %msg%n</pattern>
    </encoder>
  </appender>

  <!-- Prod: structured JSON output -->
  <appender name="JSON" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="net.logstash.logback.encoder.LogstashEncoder">
      <includeMdcKeyName>trace-id</includeMdcKeyName>
      <includeMdcKeyName>user-id</includeMdcKeyName>
      <includeMdcKeyName>method</includeMdcKeyName>
      <includeMdcKeyName>path</includeMdcKeyName>
    </encoder>
  </appender>

  <!-- Default: console appender -->
  <root level="INFO">
    <appender-ref ref="CONSOLE" />
  </root>

  <!-- Reduce noise from libraries -->
  <logger name="com.zaxxer.hikari" level="WARN" />
  <logger name="io.nats" level="WARN" />
  <logger name="org.eclipse.jetty" level="WARN" />
  <logger name="software.amazon" level="WARN" />

  <!-- App namespaces at DEBUG in dev -->
  <logger name="ajet.chat" level="DEBUG" />
</configuration>
