Sha256: 3e7e9cc17e31c406c29ca1aaaf459a7b33e22bc8cbd0f292edc3e6c200fbbfe9

Contents?: true

Size: 823 Bytes

Versions: 3

Compression:

Stored size: 823 Bytes

Contents

using System;

using NLog;
using NLog.Targets;
using NLog.Targets.Wrappers;
using System.Diagnostics;

class Example
{
    static void Main(string[] args)
    {
        FileTarget wrappedTarget = new FileTarget();
        wrappedTarget.FileName = "${basedir}/file.txt";

        FilteringTargetWrapper filteringTarget = new FilteringTargetWrapper();
        filteringTarget.WrappedTarget = wrappedTarget;

        filteringTarget.Condition = "contains('${message}','1')";

        NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(filteringTarget, LogLevel.Debug);

        Logger logger = LogManager.GetLogger("Example");
        logger.Debug("log message 0");
        logger.Debug("log message 1");
        logger.Debug("log message 2");
        logger.Debug("log message 11");
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nlog-1.0.0.505.20100822 docs/examples/targets/Configuration API/FilteringWrapper/Simple/Example.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/FilteringWrapper/Simple/Example.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/FilteringWrapper/Simple/Example.cs