-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestLoggingFormat.cs
51 lines (48 loc) · 1.22 KB
/
TestLoggingFormat.cs
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
48
49
50
51
using System;
using System.Collections.Generic;
using log4net.Config;
using NUnit.Framework;
namespace Helpful.Logging.PapertrailTest
{
/// <summary>
/// Run these tests, check papertrail, see the format.
/// </summary>
[TestFixture]
public class TestLoggingFormat
{
[OneTimeSetUp]
public void Setup()
{
XmlConfigurator.Configure();
LoggingContext.Set("key1", "AAAAAAAAAAAAAAAAAA");
}
[Test]
public void SimpleMessage()
{
this.GetLogger().Info("Logging this");
}
[Test]
public void MoreComplex()
{
LoggingContext.Set("key2", new
{
Key2P1 = "Some property value",
Key2P2 = 6600
});
this.GetLogger().Info(new
{
Something = "Some string",
SomeDate = DateTime.Now,
SomeCollection = new List<int>
{
1,2,3,4,5,6
},
SomeObject = new
{
Inner1 = "Another string",
Inner2 = (float?)null
}
});
}
}
}