<?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="Off">

  <targets>
    <!-- Log file target: Maximum 30 files, daily rotation -->
    <target xsi:type="File" name="logfile" 
            fileName="logs/${date:format=yyyy-MM-dd}.log"
            archiveFileName="logs/archive/{#}.log"
            archiveEvery="Day"
            archiveNumbering="Rolling"
            maxArchiveFiles="30"
            layout="[${date:format=yyyy-MM-dd HH\:mm\:ss}] [${level:uppercase=true}] ${message}${onexception:inner= | ${exception:format=tostring}}" />
    
    <target xsi:type="Console" name="logconsole" 
            layout="[${date:format=HH\:mm\:ss}] [${level:uppercase=true}] ${message}" />
  </targets>

  <rules>
    <logger name="NeoModbus.*" minlevel="Info" writeTo="logfile,logconsole" />
    <logger name="Microsoft.*" maxlevel="Warn" final="true" /> <!-- Ignore MS noise -->
  </rules>
</nlog>
