-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCsvPatternLayout.cs
More file actions
32 lines (28 loc) · 895 Bytes
/
CsvPatternLayout.cs
File metadata and controls
32 lines (28 loc) · 895 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using log4net.Core;
using log4net.Layout;
using log4net.Util;
namespace ImportObjectProperties.Layout
{
public class CsvPatternLayout : PatternLayout
{
public override void ActivateOptions()
{
AddConverter("newfield", typeof(NewFieldConverter));
//AddConverter(new ConverterInfo { Name = "encodedmessage", Type = typeof(LoggingEventPatternConvertor) });
AddConverter("endrow", typeof(EndRowConverter));
base.ActivateOptions();
}
public override void Format(TextWriter writer, LoggingEvent loggingEvent)
{
var ctw = new CsvTextWriter(writer);
ctw.WriteQuote();
base.Format(ctw, loggingEvent);
}
}
}