-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathLog4jXmlColumnizerConfig.cs
More file actions
80 lines (65 loc) · 1.67 KB
/
Log4jXmlColumnizerConfig.cs
File metadata and controls
80 lines (65 loc) · 1.67 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Collections.Generic;
namespace Log4jXmlColumnizer;
[Serializable]
public class Log4jXmlColumnizerConfig
{
#region cTor
public Log4jXmlColumnizerConfig (string[] columnNames)
{
FillDefaults(columnNames);
}
#endregion
#region Properties
/// <summary>
/// Returns the column count. Because the user can deactivate columns in the config
/// the actual column count may be smaller than the number of available columns.
/// </summary>
public int ActiveColumnCount
{
get
{
var count = 0;
foreach (var entry in ColumnList)
{
if (entry.Visible)
{
count++;
}
}
return count;
}
}
/// <summary>
/// Returns the names of all active columns.
/// </summary>
public string[] ActiveColumnNames
{
get
{
var names = new string[ActiveColumnCount];
var index = 0;
foreach (var entry in ColumnList)
{
if (entry.Visible)
{
names[index++] = entry.ColumnName;
}
}
return names;
}
}
public List<Log4jColumnEntry> ColumnList { get; set; } = [];
public bool LocalTimestamps { get; set; } = true;
#endregion
#region Public methods
public void FillDefaults (string[] columnNames)
{
ColumnList.Clear();
for (var i = 0; i < columnNames.Length; ++i)
{
ColumnList.Add(new Log4jColumnEntry(columnNames[i], i, 0));
}
}
#endregion
}