Click or drag to resize

Logger Class

Encapsulates system logging services using libsimpleio.
Inheritance Hierarchy
System.DiagnosticsTraceListener
  IO.Objects.SimpleIO.syslogLogger

Namespace: IO.Objects.SimpleIO.syslog
Assembly: libsimpleio (in libsimpleio.dll) Version: 2.2024.356.1
Syntax
C#
public class Logger : TraceListener

The Logger type exposes the following members.

Constructors
 NameDescription
Public methodLogger Constructor for a logging object that uses the Linux syslog service.
Top
Methods
 NameDescription
Public methodError(String) Log an error message.
Public methodError(String, Int32) Log an error message, including an errno error string.
Public methodNote Log a notification message.
Public methodWarning Log a warning message.
Public methodWrite Trace interface method for posting a message.
Public methodWriteLine Trace interface method for posting a message.
Top
Fields
 NameDescription
Public fieldStatic memberLOG_ALERT Alert condition message.
Public fieldStatic memberLOG_AUTH Authentication facility.
Public fieldStatic memberLOG_CRIT Critical condition message.
Public fieldStatic memberLOG_DAEMON System daemon/background process facility.
Public fieldStatic memberLOG_DEBUG Debug message.
Public fieldStatic memberLOG_EMERG Emergency condition message.
Public fieldStatic memberLOG_ERR Error message.
Public fieldStatic memberLOG_INFO Informational message.
Public fieldStatic memberLOG_LOCAL0 Locally defined facility.
Public fieldStatic memberLOG_LOCAL1 Locally defined facility.
Public fieldStatic memberLOG_LOCAL2 Locally defined facility.
Public fieldStatic memberLOG_LOCAL3 Locally defined facility.
Public fieldStatic memberLOG_LOCAL4 Locally defined facility.
Public fieldStatic memberLOG_LOCAL5 Locally defined facility.
Public fieldStatic memberLOG_LOCAL6 Locally defined facility.
Public fieldStatic memberLOG_LOCAL7 Locally defined facility.
Public fieldStatic memberLOG_MAIL Mail subsystem facility.
Public fieldStatic memberLOG_NDELAY Open the connection to the syslog service immediately. Recommended.
Public fieldStatic memberLOG_NOTICE Normal condition message.
Public fieldStatic memberLOG_ODELAY Do not open the connection to the syslog service before logging the first message. Not recommended.
Public fieldStatic memberLOG_PERROR Write message to both syslog service AND stderr.
Public fieldStatic memberLOG_PID Prepend the caller's process ID to the message.
Public fieldStatic memberLOG_USER User program facility. Use LOG_LOCALx instead.
Public fieldStatic memberLOG_WARNING Warning message.
Top
Remarks
An instance of this class can be used either standalone or as a System.Diagnostics.TraceListener. The static methods Systems.Diagnostics.Trace.Write() and Systems.Diagnostics.Trace.WriteIf() most naturally fit the Linux syslog facility.
Example
C#
var log = new IO.Objects.SimpleIO.syslog.Logger();
log.Note("Hello, Syslog!");

System.Diagnostics.Trace.Listeners.Clear();
System.Diagnostics.Trace.Listeners.Add(log);
System.Diagnostics.Trace.Write("Hello, Trace!");
See Also