-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLogElement.cs
105 lines (96 loc) · 2.51 KB
/
LogElement.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Youzee.Util.Logger
{
/**
* Single log configuration element
*
* @copyright (C) Youzee (2012)
* @author Keyvan Akbary <[email protected]>
* @version 1.0
*/
public class LogElement : ConfigurationElement
{
private const string LEVEL_PARAMETER_NAME = "level";
private const string FILE_PATH_PARAMETER_NAME = "filePath";
private const string DISABLED_PATH_PARAMETER_NAME = "disabled";
private const string TRUE_VALUE = "true";
private const string FALSE_VALUE = "false";
[ConfigurationProperty(LEVEL_PARAMETER_NAME, IsRequired = true)]
public string Level
{
get
{
return (string)this[LEVEL_PARAMETER_NAME];
}
set
{
this[LEVEL_PARAMETER_NAME] = value;
}
}
[ConfigurationProperty(FILE_PATH_PARAMETER_NAME, IsRequired = false)]
public string FilePath
{
get
{
return (string)this[FILE_PATH_PARAMETER_NAME];
}
set
{
this[FILE_PATH_PARAMETER_NAME] = value;
}
}
[ConfigurationProperty(DISABLED_PATH_PARAMETER_NAME, IsRequired = false)]
public string Disabled
{
get
{
return (string)this[DISABLED_PATH_PARAMETER_NAME];
}
set
{
this[DISABLED_PATH_PARAMETER_NAME] = value;
}
}
/**
* @return bool
*/
public bool IsEnabled()
{
return Disabled != TRUE_VALUE;
}
/**
* Constructor
*/
public LogElement()
{
}
/**
* Constructor
*
* @param string level
* @param string filePath
*/
public LogElement(string level, string filePath)
{
Level = level;
FilePath = filePath;
}
/**
* Constructor
*
* @param string level
* @param string filePath
* @param bool disabled
*/
public LogElement(string level, string filePath, bool disabled)
{
Level = level;
FilePath = filePath;
Disabled = (disabled) ? TRUE_VALUE : FALSE_VALUE;
}
}
}