<?xml version="1.0"?>
<configuration>

    <!-- Do not print status to console (this kills the language server protocol) -->
    <statusListener class="ch.qos.logback.core.status.NopStatusListener"/>

    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <!-- encoders are  by default assigned the type
             ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>
    <appender name="compiler_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${user.home}/.wurst/logs/compiler.log</file>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{35} - %msg %n</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>${user.home}/.wurst/logs/compiler_backup%i.htm
            </fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>2</maxIndex>
        </rollingPolicy>
        <triggeringPolicy
                class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>1MB</maxFileSize>
        </triggeringPolicy>
    </appender>
    <appender name="lang_server_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${user.home}/.wurst/logs/languageServer.log</file>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{35} - %msg %n</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>${user.home}/.wurst/logs/languageServer_backup%i.htm
            </fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>2</maxIndex>
        </rollingPolicy>
        <triggeringPolicy
                class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>1MB</maxFileSize>
        </triggeringPolicy>
    </appender>

    <logger name="languageServer" level="info" additivity="false">
        <appender-ref ref="lang_server_log"/>
    </logger>
    <logger name="default" level="info">
        <appender-ref ref="compiler_log"/>
    </logger>
    <root level="debug">
        <appender-ref ref="compiler_log"/>
    </root>
</configuration>
