BililiveRecorder/BililiveRecorder.WPF/Nlog.Release.config
2018-11-01 23:40:50 +08:00

43 lines
1.9 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"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<targets>
<target name="WPFLogger" xsi:type="MethodCall" className="BililiveRecorder.WPF.MainWindow, BililiveRecorder.WPF" methodName="AddLog">
<parameter layout="[${date:format=HH\:mm\:ss}] ${uppercase:${level}} ${event-properties:item=roomid} ${message} ${exception:format=Message}" />
</target>
<target name="file" xsi:type="File"
encoding="utf-8"
lineEnding="CRLF"
fileName="log.txt"
maxArchiveFiles="15"
archiveFileName="log_archive.{#}.txt"
archiveNumbering="Date"
archiveEvery="Day"
archiveDateFormat="yyyyMMdd">
<layout xsi:type="JsonLayout">
<attribute name='time' layout='${longdate}' />
<attribute name='level' layout='${level:upperCase=true}'/>
<attribute name='pid' layout='${processid}'/>
<attribute name='logger' layout='${logger}'/>
<attribute name='roomid' layout='${event-properties:item=roomid}'/>
<attribute name='message' layout='${message}'/>
<attribute name='exception' encode='false'>
<layout xsi:type='JsonLayout'>
<attribute name='type' layout='${exception:format=Type}'/>
<attribute name='message' layout='${exception:format=Message}'/>
<attribute name='tostring' layout='${exception:format=ToString}'/>
</layout>
</attribute>
</layout>
</target>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="WPFLogger"/>
<logger name="*" minlevel="Trace" writeTo="file"/>
</rules>
</nlog>