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

	<!-- 定义日志级别和规则 -->
	<extensions>
		<add assembly="NLog.Web.AspNetCore"/>
	</extensions>

	<targets>
		<!-- 将日志写入文件 -->
		<target xsi:type="File" name="file" archiveAboveSize="20480" archiveEvery="Day" archiveNumbering="Sequence" maxArchiveFiles="7" fileName="${basedir}/logs/nlog-${shortdate}.log"
		layout="${date:format=HH\:mm\:ss.fff} [${threadid}:${level:uppercase=true}]${logger} - ${message} ${exception}" />

		<!-- 将日志写入控制台 -->
		<target xsi:type="Console" name="console" layout="${date:format=HH\:mm\:ss.fff} [${threadid}:${level:uppercase=true}]${logger} - ${message} ${exception}" />
	</targets>

	<rules>
		<!-- 捕获所有级别的日志并将其写入文件和控制台 -->
		<logger name="*" minlevel="Info" writeTo="file,console" />
	</rules>
</nlog>