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

	<!-- optional, add some variables
  https://github.com/nlog/NLog/wiki/Configuration-file#variables
  -->

	<!--Notes
  please note that the method name won't work well with async methods before NLog 4.3 - it will always show MoveNext.
  Please also note that this infers heavy performance hit when doing lots of logging, as it has to capture full StackTrace for every log message.
  If symbol symbol information is not available, then it will not be able to output source-code filename or line-number. Symbol information from PDB files must be deployed with the application to retrieve and output source-code line-number. For applications compiled in release mode, then inlining can occur and cause "unexpected" line-numbers.
  -->

	<variable name="ServiceFileLayout" value="${longdate} | [${threadid}] | [${callsite}]${newline}${message}${newline}${exception:format=ToString}${newline}"/>

	<variable name="BasePath" value="${basedir}/Logs/"/>
	<variable name="ServiceFilePath" value="${BasePath}/Cur_${level:uppercase=true}.log"/>
	<variable name="ArchivePath" value="${BasePath}/${level:uppercase=true}_{#}.log"/>

	<variable name="ArchiveSize" value ="5242880"/>
	<variable name="TestSize" value ="1024"/>

	<!--
  See https://github.com/nlog/nlog/wiki/Configuration-file
  for information on customizing logging rules and outputs.
   -->
	<targets>

		<!--
    add your targets here
    See https://github.com/nlog/NLog/wiki/Targets for possible targets.
    See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
    -->

		<!--
    Write events to a file with the date in the filename.
    <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
            layout="${longdate} ${uppercase:${level}} ${message}" />
    -->

		<target name="ServiceFile" xsi:type="File" fileName="${ServiceFilePath}" layout="${ServiceFileLayout}"
			archiveFileName="${ArchivePath}"
			archiveAboveSize="${ArchiveSize}"
			archiveNumbering ="DateAndSequence"
			archiveEvery="Hour"
			archiveDateFormat ="yyyy-MM-dd-HH"
			maxArchiveDays="7"
			encoding="utf-8"
        />

	</targets>

	<rules>
		<!-- add your logging rules here -->

		<!--
    Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace)  to "f"
    <logger name="*" minlevel="Debug" writeTo="f" />
    -->

		<logger name="*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="ServiceFile">
			<filters defaultAction='Log'>
				<when condition="contains('${callsite}','ExecuteAsync')" action="Ignore" />
			</filters>
		</logger>
	
	</rules>
</nlog>
