Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 291aaa5904
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 48 lines (44 sloc) 1.038 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DemoApp
{
public partial class Form1 : Form
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();

public Form1()
{
InitializeComponent();
}

private void ButtonLog_Click(object sender, EventArgs e)
{
var btn = (Button)sender;
switch (btn.Name)
{
case "buttonTrace":
logger.Trace("This is a sample trace message");
break;
case "buttonDebug":
logger.Debug("This is a sample debug message");
break;
case "buttonInfo":
logger.Info("This is a sample info message");
break;
case "buttonWarn":
logger.Warn("This is a sample warn message");
break;
case "buttonError":
logger.Error("This is a sample error message");
break;
case "buttonFatal":
logger.Fatal("This is a sample fatal message");
break;
}
}
}
}
Something went wrong with that request. Please try again.