<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- Console appender for development -->
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}:%L - %msg%n</pattern>
        </encoder>
    </appender>

    <!-- File appender for persistent logs -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${user.home}/.askimo/logs/askimo-desktop.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- Daily rollover -->
            <fileNamePattern>${user.home}/.askimo/logs/askimo-desktop.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- Keep 7 days worth of history -->
            <maxHistory>7</maxHistory>
            <!-- Total size cap of 100MB -->
            <totalSizeCap>100MB</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}:%L - %msg%n</pattern>
        </encoder>
    </appender>

    <!-- Root logger configuration - suppress all other packages -->
    <root level="OFF">
    </root>

    <!-- Askimo application logging - controlled by LOGBACK_LEVEL env var -->
    <logger name="io.askimo" level="${LOGBACK_LEVEL:-INFO}" additivity="false">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="FILE" />
    </logger>
</configuration>

