Sha256: 3e81f8d397e3a6c8bd14f0d160eb877bd96f5e1167595d6356a66f51ac86640d

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

using NLog;
using NLog.Win32.Targets;

class Example
{
    static void Main(string[] args)
    {
        ColoredConsoleTarget target = new ColoredConsoleTarget();
        target.Layout = "${date:format=HH\\:MM\\:ss} ${logger} ${message}";
        target.WordHighlightingRules.Add(
                new ConsoleWordHighlightingRule("log", 
                    ConsoleOutputColor.NoChange, 
                    ConsoleOutputColor.DarkGreen));
        target.WordHighlightingRules.Add(
                new ConsoleWordHighlightingRule("abc", 
                    ConsoleOutputColor.Cyan, 
                    ConsoleOutputColor.NoChange));
                

        NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Trace);

        Logger logger = LogManager.GetLogger("Example");
        logger.Trace("trace log message abcdefghijklmnopq");
        logger.Debug("debug log message");
        logger.Info("info log message abc abcdefghijklmnopq");
        logger.Warn("warn log message");
        logger.Error("error log abcdefghijklmnopq message abc");
        logger.Fatal("fatal log message abcdefghijklmnopq abc");
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nlog-1.0.0.505.20100822 docs/examples/targets/Configuration API/ColoredConsole/Word Highlighting/Example.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/ColoredConsole/Word Highlighting/Example.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/ColoredConsole/Word Highlighting/Example.cs