<?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">

	<variable name="defaultLogFormat" value="${time} [${level:uppercase=true}] ${logger} | ${message} ${exception:format=ToString,StackTrace:innerFormat=ToString,StackTrace}"/>

	<!-- Define the targets where log messages will be sent -->
	<targets>
		<!-- Target to write log messages to a file -->
		<target xsi:type="File" name="fileTarget" fileName="${specialfolder:folder=LocalApplicationData}/VirtualXtensions/VXMusic/Logs/VXMusicDesktop/VXMusic-${longdate:cached=true}.log" layout="${defaultLogFormat}" />

		<!-- Target to write log messages to the console -->
		<target xsi:type="ColoredConsole"
				name="consoleTarget"
				detectConsoleAvailable="Boolean"
				useDefaultRowHighlightingRules="false"
				layout="${defaultLogFormat}" >
			<highlight-row condition="level == LogLevel.Trace" foregroundColor="DarkGray" />
			<highlight-row condition="level == LogLevel.Debug" foregroundColor="Gray" />
			<highlight-row condition="level == LogLevel.Info" foregroundColor="White" />
			<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
			<highlight-row condition="level == LogLevel.Error" foregroundColor="Red" />
			<highlight-row condition="level == LogLevel.Fatal" foregroundColor="Red" backgroundColor="White" />
		</target>

		<target xsi:type="Trace" name="traceTarget" rawWrite="true" layout="${defaultLogFormat}" />

	</targets>

	<!-- Define rules to determine which log messages are sent to which targets -->
	<rules>
		<!-- Log everything to both the file and console targets -->
		<logger name="*" minlevel="Trace" writeTo="consoleTarget,traceTarget" />
		<logger name="*" minlevel="Trace" writeTo="fileTarget" />
	</rules>
</nlog>
