This repository has been archived on 2024-03-29. You can view files and clone it, but cannot push or open issues or pull requests.
FreeSR/FreeSR.Shared/nlog.config
2024-01-27 21:06:07 +08:00

29 lines
No EOL
1.5 KiB
XML

<?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">
<targets>
<target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
layout="${date:format=HH\:mm\:ss} [${level:uppercase=true}] ${logger:shortName=true}: ${message}" >
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
<highlight-row condition="level == LogLevel.Info" foregroundColor="Blue" />
<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 name="infoFile" xsi:type="File"
layout="${longdate} ${pad:padding=5:inner=${level:uppercase=true}} ${logger} ${message}"
fileName="${basedir}/logs/info.log" keepFileOpen="false" encoding="iso-8859-2" />
<target name="errorFile" xsi:type="File"
layout="${longdate} ${pad:padding=5:inner=${level:uppercase=true}} ${logger} ${message}"
fileName="${basedir}/logs/error.log" keepFileOpen="false" encoding="iso-8859-2" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="coloredConsole" />
<logger name="*" minlevel="Debug" maxlevel="Info" writeTo="infoFile" />
<logger name="*" minlevel="Warn" maxlevel="Fatal" writeTo="errorFile" />
</rules>
</nlog>