<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      internalLogLevel="Error"
      internalLogFile="${basedir}/logs/internal-nlog.txt">
    <time xsi:type="" />
    <targets>
        <target name="pacLogFile" xsi:type="File"
                fileName="${basedir}/logs/pac-log.txt"
                archiveFileName="${basedir}/logs/pac-log.archive.{#####}.txt"
                archiveAboveSize="10485760"
                archiveNumbering="Sequence"
                concurrentWrites="true"
                maxArchiveFiles="100"
                keepFileOpen="false"
                openFileCacheTimeout="30"
                layout="${longdate:universalTime=true} | ${level:format=TriLetter:uppercase=true} | ${logger} :: ${message}${onexception:|EXCEPTION\: ${exception:format=tostring:maxInnerExceptionLevel=10}}"
            />
        <target name="AllTraceFile" xsi:type="File"
                fileName="${basedir}/logs/trace-log.txt"
                archiveFileName="${basedir}/logs/trace-log.archive.{#####}.txt"
                archiveAboveSize="10485760"
                archiveNumbering="Sequence"
                concurrentWrites="true"
                maxArchiveFiles="5"
                keepFileOpen="false"
                openFileCacheTimeout="30"
                layout="${longdate:universalTime=true} | ${level:format=TriLetter:uppercase=true} | ${logger} :: ${message}${onexception:|EXCEPTION\: ${exception:format=tostring:maxInnerExceptionLevel=10}}"
            />
    </targets>

    <rules>
        <!-- Valid levels (lowest to highest): Trace,Debug,Info,Warn,Error,Fatal -->

        <!-- <logger name="*" minlevel="Trace" writeTo="AllTraceFile" /> -->

        <!-- Explicitly enable rules when needing more detailed logic by uncommenting: -->
        <!--<logger name="Microsoft.PowerPlatform.Dataverse.Client.*" minlevel="Trace" writeto="pacIntegrationLogFile" final="true" />-->

        <!-- Ignore rules:
    <logger name="bolt.*" maxlevel="Debug" final="true" />
    <logger name="Microsoft.Identity.Client.*" maxlevel="Debug" final="true" />
    <logger name="Microsoft.PowerPlatform.Dataverse.Client.*" maxlevel="Debug" final="true" />
    <logger name="Microsoft.PowerPlatform.Tooling.Integration.*" maxlevel="Debug" final="true" />
    -->
        <!-- Fallback catch-all, don't log debug/trace
    <logger name="*" maxlevel="Debug" final="true" />-->

        <!-- Ignore rules -->
        <logger name="Microsoft.Identity.Client.*" finalMinLevel="Warn" />

        <!-- Log the rest -->
        <logger name="*" minlevel="Info" writeTo="pacLogFile" />
    </rules>
</nlog>
