NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Common.Log.LogFactory Class Reference

Static Public Member Functions

static void Cleanup ()
 
static void Close ()
 
static ActivityLog CreateActivityLog ()
 
static LogGroup CreateErrorLog (string name)
 
static LogGroup CreateGroupLog ()
 
static LogBase CreateLog (ILogConfiguration config)
 
static LogBase CreateLog (IEnumerable< ILogConfiguration > configs)
 
static LogBase CreateSysLog (string name)
 
static void Resume ()
 
static void Suspend ()
 

Static Public Attributes

static string ApplicationName
 

Static Private Member Functions

static LogBase CreateLogInternal (ILogConfiguration config)
 

Static Private Attributes

static readonly List< LogBaseLogs = new List<LogBase>()
 

Detailed Description

Definition at line 28 of file LogFactory.cs.

Member Function Documentation

static void Ntp.Common.Log.LogFactory.Cleanup ( )
inlinestatic

Definition at line 33 of file LogFactory.cs.

Referenced by Ntp.Analyzer.Process.Main.Run().

34  {
35  Close();
36  Logs.Clear();
37  }
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31

Here is the caller graph for this function:

static void Ntp.Common.Log.LogFactory.Close ( )
inlinestatic

Definition at line 39 of file LogFactory.cs.

40  {
41  foreach (var log in Logs)
42  log.Close();
43  }
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31
static ActivityLog Ntp.Common.Log.LogFactory.CreateActivityLog ( )
inlinestatic

Definition at line 45 of file LogFactory.cs.

Referenced by Ntp.Common.Process.Scheduler.Scheduler().

46  {
47  return new ActivityLog();
48  }

Here is the caller graph for this function:

static LogGroup Ntp.Common.Log.LogFactory.CreateErrorLog ( string  name)
inlinestatic

Definition at line 50 of file LogFactory.cs.

Referenced by Ntp.Analyzer.Cli.Program.Main().

51  {
52  var log = new LogGroup
53  {
54  new ConsoleLog(Severity.Error)
55  {
56  ShowSeverity = false,
57  ShowTimeStamp = false
58  }
59  };
60  return log;
61  }

Here is the caller graph for this function:

static LogGroup Ntp.Common.Log.LogFactory.CreateGroupLog ( )
inlinestatic

Definition at line 63 of file LogFactory.cs.

Referenced by Ntp.Common.Process.Scheduler.Scheduler().

64  {
65  return new LogGroup();
66  }

Here is the caller graph for this function:

static LogBase Ntp.Common.Log.LogFactory.CreateLog ( ILogConfiguration  config)
inlinestatic

Definition at line 68 of file LogFactory.cs.

Referenced by Ntp.Analyzer.Process.Initializer.InitializeLog().

69  {
70  var log = CreateLogInternal(config);
71  Logs.Add(log);
72  return log;
73  }
static LogBase CreateLogInternal(ILogConfiguration config)
Definition: LogFactory.cs:108
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31

Here is the caller graph for this function:

static LogBase Ntp.Common.Log.LogFactory.CreateLog ( IEnumerable< ILogConfiguration configs)
inlinestatic

Definition at line 75 of file LogFactory.cs.

76  {
77  var group = new LogGroup();
78 
79  foreach (var config in configs)
80  {
81  var log = CreateLogInternal(config);
82  group.Add(log);
83  Logs.Add(log);
84  }
85 
86  return group;
87  }
static LogBase CreateLogInternal(ILogConfiguration config)
Definition: LogFactory.cs:108
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31
static LogBase Ntp.Common.Log.LogFactory.CreateLogInternal ( ILogConfiguration  config)
inlinestaticprivate

Definition at line 108 of file LogFactory.cs.

References Ntp.Common.Log.ILogConfiguration.File, Ntp.Common.Log.ILogConfiguration.LogType, Ntp.Common.Log.ILogConfiguration.ShowSeverity, Ntp.Common.Log.ILogConfiguration.ShowTimestamp, Ntp.Common.Log.ILogConfiguration.Threshold, and Ntp.Common.Log.ILogConfiguration.TimeFormat.

109  {
110  switch (config.LogType)
111  {
112  case LogType.Unknown:
113  case LogType.Console:
114  return new ConsoleLog(config.Threshold, config.TimeFormat)
115  {
116  ShowSeverity = config.ShowSeverity,
117  ShowTimeStamp = config.ShowTimestamp
118  };
119  case LogType.Syslog:
120  return new SysLog(ApplicationName, config.Threshold);
121  case LogType.EventLog:
122  return new EventLog(ApplicationName, config.Threshold);
123  case LogType.File:
124  return new FileLog(config.File, config.Threshold, config.TimeFormat)
125  {
126  ShowSeverity = config.ShowSeverity,
127  ShowTimeStamp = config.ShowTimestamp
128  };
129  default:
130  throw new ArgumentOutOfRangeException(nameof(config));
131  }
132  }
static string ApplicationName
Definition: LogFactory.cs:30
static LogBase Ntp.Common.Log.LogFactory.CreateSysLog ( string  name)
inlinestatic

Definition at line 89 of file LogFactory.cs.

References Ntp.Common.System.ProcessInfo.CreateSystemLog().

Referenced by Ntp.Analyzer.Cli.Program.Main().

90  {
91  var log = ProcessInfo.CreateSystemLog(name);
92  Logs.Add(log);
93  return log;
94  }
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31
static LogBase CreateSystemLog(string name)
Definition: ProcessInfo.cs:34

Here is the call graph for this function:

Here is the caller graph for this function:

static void Ntp.Common.Log.LogFactory.Resume ( )
inlinestatic

Definition at line 96 of file LogFactory.cs.

Referenced by Ntp.Common.System.SignalHandler.Execute().

97  {
98  foreach (var log in Logs)
99  log.Resume();
100  }
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31

Here is the caller graph for this function:

static void Ntp.Common.Log.LogFactory.Suspend ( )
inlinestatic

Definition at line 102 of file LogFactory.cs.

Referenced by Ntp.Common.System.SignalHandler.Execute().

103  {
104  foreach (var log in Logs)
105  log.Suspend();
106  }
static readonly List< LogBase > Logs
Definition: LogFactory.cs:31

Here is the caller graph for this function:

Member Data Documentation

string Ntp.Common.Log.LogFactory.ApplicationName
static

Definition at line 30 of file LogFactory.cs.

readonly List<LogBase> Ntp.Common.Log.LogFactory.Logs = new List<LogBase>()
staticprivate

Definition at line 31 of file LogFactory.cs.


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