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

Public Member Functions

 SysLog (string name, Severity threshold)
 
override void Close ()
 
override void Initialize ()
 
override void Resume ()
 
override void Suspend ()
 
override void WriteLine (Exception exception)
 
override void WriteLine (Exception exception, Severity severity)
 
override void WriteLine (string text, Severity severity)
 

Static Private Member Functions

static SyslogLevel GetSyslogLevel (Severity severity)
 

Private Attributes

const SyslogFacility Facility = SyslogFacility.LOG_DAEMON
 
readonly string name
 
const SyslogOptions Options = SyslogOptions.LOG_PID
 

Static Private Attributes

static bool initialized
 

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 SysLog.cs.

Constructor & Destructor Documentation

Ntp.Common.Log.SysLog.SysLog ( string  name,
Severity  threshold 
)
inline

Definition at line 30 of file SysLog.cs.

31  : base(threshold, true)
32  {
33  this.name = name;
34  }
readonly string name
Definition: SysLog.cs:40

Member Function Documentation

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

Implements Ntp.Common.Log.LogBase.

Definition at line 42 of file SysLog.cs.

43  {
44  if (initialized)
45  return;
46 
47  Syscall.closelog();
48  initialized = false;
49  }
static bool initialized
Definition: SysLog.cs:38
static SyslogLevel Ntp.Common.Log.SysLog.GetSyslogLevel ( Severity  severity)
inlinestaticprivate

Definition at line 92 of file SysLog.cs.

93  {
94  switch (severity)
95  {
96  case Severity.Error:
97  return SyslogLevel.LOG_ERR;
98  case Severity.Warn:
99  return SyslogLevel.LOG_WARNING;
100  case Severity.Notice:
101  return SyslogLevel.LOG_NOTICE;
102  case Severity.Info:
103  return SyslogLevel.LOG_INFO;
104  case Severity.Debug:
105  case Severity.Trace:
106  return SyslogLevel.LOG_DEBUG;
107  default:
108  return SyslogLevel.LOG_DEBUG;
109  }
110  }
override void Ntp.Common.Log.SysLog.Initialize ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 51 of file SysLog.cs.

52  {
53  if (initialized)
54  return;
55 
56  string ident = name;
57  Syscall.openlog(UnixMarshal.StringToHeap(ident), Options, Facility);
58  initialized = true;
59  }
const SyslogOptions Options
Definition: SysLog.cs:37
readonly string name
Definition: SysLog.cs:40
static bool initialized
Definition: SysLog.cs:38
const SyslogFacility Facility
Definition: SysLog.cs:36
override void Ntp.Common.Log.SysLog.Resume ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 61 of file SysLog.cs.

62  {
63  // SysLog cannot resume
64  }
override void Ntp.Common.Log.SysLog.Suspend ( )
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 66 of file SysLog.cs.

67  {
68  // SysLog cannot suspend
69  }
override void Ntp.Common.Log.SysLog.WriteLine ( Exception  exception)
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 71 of file SysLog.cs.

Referenced by Ntp.Common.Log.LogGroup.WriteLine().

72  {
73  WriteLine(exception, Severity.Error);
74  }
override void WriteLine(Exception exception)
Definition: SysLog.cs:71

Here is the caller graph for this function:

override void Ntp.Common.Log.SysLog.WriteLine ( Exception  exception,
Severity  severity 
)
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 76 of file SysLog.cs.

77  {
78  WriteLine(exception.Message, Severity.Error);
79  }
override void WriteLine(Exception exception)
Definition: SysLog.cs:71
override void Ntp.Common.Log.SysLog.WriteLine ( string  text,
Severity  severity 
)
inlinevirtual

Implements Ntp.Common.Log.LogBase.

Definition at line 81 of file SysLog.cs.

82  {
83  if (initialized)
84  Initialize();
85 
86  if (severity < Threshold)
87  return;
88 
89  Syscall.syslog(Facility, GetSyslogLevel(severity), text);
90  }
override void Initialize()
Definition: SysLog.cs:51
static SyslogLevel GetSyslogLevel(Severity severity)
Definition: SysLog.cs:92
Severity Threshold
Definition: LogBase.cs:34
static bool initialized
Definition: SysLog.cs:38
const SyslogFacility Facility
Definition: SysLog.cs:36

Member Data Documentation

const SyslogFacility Ntp.Common.Log.SysLog.Facility = SyslogFacility.LOG_DAEMON
private

Definition at line 36 of file SysLog.cs.

bool Ntp.Common.Log.SysLog.initialized
staticprivate

Definition at line 38 of file SysLog.cs.

readonly string Ntp.Common.Log.SysLog.name
private

Definition at line 40 of file SysLog.cs.

const SyslogOptions Ntp.Common.Log.SysLog.Options = SyslogOptions.LOG_PID
private

Definition at line 37 of file SysLog.cs.


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