Sha256: 1846b7e23b82f4a3e46750bbe9c372fc232771dd5027e6389b1db843aeb0dfd4

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

using System;
using System.Text;
using System.Windows.Forms;
using NLog;
using NLog.Targets;

namespace RichTextBox2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            FormControlTarget target = new FormControlTarget();
            target.Layout = "${date:format=HH\\:MM\\:ss} ${logger} ${message}";
            target.ControlName = "textBox1";
            target.FormName = "Form1";
            target.Append = true;

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nlog-1.0.0.505.20100822 docs/examples/targets/Configuration API/FormControl/Form1.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/FormControl/Form1.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/FormControl/Form1.cs