NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Common.Log.ActivityLog Class Reference
Inheritance diagram for Ntp.Common.Log.ActivityLog:
Collaboration diagram for Ntp.Common.Log.ActivityLog:

Public Member Functions

override void Close ()
 
IEnumerator< string > GetEnumerator ()
 
override void Initialize ()
 
override void Resume ()
 
override void Suspend ()
 
override void WriteLine (string text, Severity severity)
 
override void WriteLine (Exception exception)
 
override void WriteLine (Exception exception, Severity severity)
 

Package Functions

 ActivityLog ()
 

Private Member Functions

IEnumerator IEnumerable. GetEnumerator ()
 

Private Attributes

readonly List< string > activity
 
readonly object locker = new object()
 

Additional Inherited Members

- Protected Member Functions inherited from Ntp.Common.Log.LogBase
 LogBase (Severity threshold, bool isSysLog=false)
 
- Properties inherited from Ntp.Common.Log.LogBase
bool IsSysLog [get]
 
Severity Threshold [get]
 

Detailed Description

Definition at line 28 of file ActivityLog.cs.

Constructor & Destructor Documentation

Ntp.Common.Log.ActivityLog.ActivityLog ( )
inlinepackage

Definition at line 30 of file ActivityLog.cs.

References Ntp.Common.Log.Debug.

31  : base(Severity.Debug)
32  {
33  activity = new List<string>(2001);
34  }
readonly List< string > activity
Definition: ActivityLog.cs:36

Member Function Documentation

override void Ntp.Common.Log.ActivityLog.Close ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 49 of file ActivityLog.cs.

50  {
51  activity.Clear();
52  }
readonly List< string > activity
Definition: ActivityLog.cs:36
IEnumerator<string> Ntp.Common.Log.ActivityLog.GetEnumerator ( )
inline

Definition at line 39 of file ActivityLog.cs.

40  {
41  return activity.GetEnumerator();
42  }
readonly List< string > activity
Definition: ActivityLog.cs:36
IEnumerator IEnumerable. Ntp.Common.Log.ActivityLog.GetEnumerator ( )
inlineprivate

Definition at line 44 of file ActivityLog.cs.

45  {
46  return activity.GetEnumerator();
47  }
readonly List< string > activity
Definition: ActivityLog.cs:36
override void Ntp.Common.Log.ActivityLog.Initialize ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 54 of file ActivityLog.cs.

55  {
56  activity.Clear();
57  }
readonly List< string > activity
Definition: ActivityLog.cs:36
override void Ntp.Common.Log.ActivityLog.Resume ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 59 of file ActivityLog.cs.

60  {
61  }
override void Ntp.Common.Log.ActivityLog.Suspend ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 63 of file ActivityLog.cs.

64  {
65  }
override void Ntp.Common.Log.ActivityLog.WriteLine ( string  text,
Severity  severity 
)
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 67 of file ActivityLog.cs.

68  {
69  string severityText;
70 
71  if (severity == Severity.Trace)
72  return;
73 
74  switch (severity)
75  {
76  case Severity.Error:
77  severityText = "E";
78  break;
79  case Severity.Warn:
80  severityText = "W";
81  break;
82  case Severity.Notice:
83  severityText = "N";
84  break;
85  case Severity.Info:
86  severityText = "I";
87  break;
88  case Severity.Debug:
89  severityText = "D";
90  break;
91  case Severity.Trace:
92  severityText = "T";
93  break;
94  default:
95  throw new ArgumentOutOfRangeException(nameof(severity));
96  }
97 
98  var now = DateTime.Now;
99  string entry = string.Concat(
100  now.ToString("HH:mm:ss"),
101  " ", severityText, " ",
102  text);
103 
104  lock (locker)
105  {
106  if (activity.Count == 1000)
107  activity.RemoveAt(0);
108 
109  activity.Add(entry);
110  }
111  }
readonly List< string > activity
Definition: ActivityLog.cs:36
readonly object locker
Definition: ActivityLog.cs:37
override void Ntp.Common.Log.ActivityLog.WriteLine ( Exception  exception)
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 113 of file ActivityLog.cs.

114  {
115  WriteLine(exception.Message, Severity.Error);
116  WriteLine(exception.StackTrace, Severity.Debug);
117  }
override void WriteLine(string text, Severity severity)
Definition: ActivityLog.cs:67
override void Ntp.Common.Log.ActivityLog.WriteLine ( Exception  exception,
Severity  severity 
)
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 119 of file ActivityLog.cs.

120  {
121  if (severity == Severity.Trace)
122  return;
123 
124  WriteLine(exception.Message, severity);
125  WriteLine(exception.StackTrace, severity);
126  }
override void WriteLine(string text, Severity severity)
Definition: ActivityLog.cs:67

Member Data Documentation

readonly List<string> Ntp.Common.Log.ActivityLog.activity
private

Definition at line 36 of file ActivityLog.cs.

readonly object Ntp.Common.Log.ActivityLog.locker = new object()
private

Definition at line 37 of file ActivityLog.cs.


The documentation for this class was generated from the following file: