A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nlog/NLog/wiki/AutoFlushWrapper-target below:

AutoFlushWrapper target · NLog/NLog Wiki · GitHub

Causes a flush on a wrapped target if LogEvent satisfies provided condition.
If condition isn't set, a flush will occur after each successful write.

Platforms Supported: All

<targets>
  <target xsi:type="AutoFlushWrapper" name="String" condition="Condition">
    <target xsi:type="wrappedTargetType" ...target properties... />
  </target>
</targets>

Flush into target on each write

<?xml version="1.0" ?>
<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">
    <targets>
        <target name="file" xsi:type="AutoFlushWrapper">
            <target xsi:type="File" fileName="${basedir}/file.txt" />
        </target>
    </targets>
    <rules>
        <logger name="*" minlevel="Debug" writeTo="file" />
    </rules>
</nlog>

Flush into target, if LogEvent level >= Warn (introduced in NLog 4.4)

<?xml version="1.0" ?>
<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">
    <targets>
        <target name="file" xsi:type="AutoFlushWrapper" condition="level >= LogLevel.Warn">
            <target xsi:type="bufferingWrapper" overflowAction="Discard">
               <target xsi:type="File" fileName="${basedir}/file.txt" />
            </target>
        </target>
    </targets>
    <rules>
        <logger name="*" minlevel="Debug" writeTo="file" />
    </rules>
</nlog>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4