DirectOutput
DirectOutput framework R3 for virtual pinball cabinets.
Loading...
Searching...
No Matches
DirectOutput.Log Class Reference

A simple logger used to record important events and exceptions.
More...

Static Public Member Functions

static void Init ()
 Initializes the log using the file defined in the Filename property.
static void AfterInit ()
 Finalize initialization. Call during startup. If logging will be used, call after Init(). Otherwise call at any convenient point during startup.
static void Finish ()
 Finishes the logger.
Closes the log file.
static void Write (string Message)
 Writes the specified message to the logfile.
static void Error (string Message)
 Writes an error message to the log.
static void Once (string key, string message)
 One-time message logging. Logs a message, identified by a string key, only the first time the key is used. This is useful for logging information that's always stable throughout a session, and.
static void Warning (string Message)
 Writes a warning message to the log.
static void Exception (string Message, Exception E=null)
 Writes a exception message to the log.
static void Exception (Exception E)
 Writes a exception to the log.
static void Instrumentation (string key, string Message)
 Writes the specified instrumentation debug message to the log file, ONLY IF the provided key is one of the keys specified in the <Instrumentation> element in the GlobalConfig.xml file. If the key isn't listed there, the message is suppressed. This can be used for debugging messages that you don't want to include in the log EXCEPT during development work, or when helping a user troubleshoot a problem that requires visibility into low-level details. This is especially useful for messages that are generated many times during a session, such as messages generated every time an output port is triggered.
static void Debug (string Message)
 Writes the specified debug message to the log file.

Static Protected Attributes

static HashSet< string > OneTimeLogMessages = new HashSet<string>()

Properties

static string Filename [get, set]
 Gets or sets the filename for the log.
static string Instrumentations [set]

Detailed Description

A simple logger used to record important events and exceptions.

Member Function Documentation

◆ AfterInit()

void DirectOutput.Log.AfterInit ( )
static

Finalize initialization. Call during startup. If logging will be used, call after Init(). Otherwise call at any convenient point during startup.

◆ Debug()

void DirectOutput.Log.Debug ( string Message)
static

Writes the specified debug message to the log file.

Parameters
MessageThe message to be written to the log file.

◆ Error()

void DirectOutput.Log.Error ( string Message)
static

Writes an error message to the log.

Parameters
MessageThe message.

◆ Exception() [1/2]

void DirectOutput.Log.Exception ( Exception E)
static

Writes a exception to the log.

Parameters
EThe Exception to be logged.

◆ Exception() [2/2]

void DirectOutput.Log.Exception ( string Message,
Exception E = null )
static

Writes a exception message to the log.

Parameters
MessageThe message.
EThe Exception to be logged.

◆ Finish()

void DirectOutput.Log.Finish ( )
static

Finishes the logger.
Closes the log file.

◆ Init()

void DirectOutput.Log.Init ( )
static

Initializes the log using the file defined in the Filename property.

◆ Instrumentation()

void DirectOutput.Log.Instrumentation ( string key,
string Message )
static

Writes the specified instrumentation debug message to the log file, ONLY IF the provided key is one of the keys specified in the <Instrumentation> element in the GlobalConfig.xml file. If the key isn't listed there, the message is suppressed. This can be used for debugging messages that you don't want to include in the log EXCEPT during development work, or when helping a user troubleshoot a problem that requires visibility into low-level details. This is especially useful for messages that are generated many times during a session, such as messages generated every time an output port is triggered.

The <Instrumentation> element in the config file can also be set to a single asterisk (*) to enable ALL of the instrumentation keys. That means that you shouldn't use "*" as an actual message key, of course.

Parameters
keyThe instrumentation key. This is an arbitrary string identifying the instrumentation source, to determine whether or not to include the message in the log.
MessageThe message to be written to the log file.

◆ Once()

void DirectOutput.Log.Once ( string key,
string message )
static

One-time message logging. Logs a message, identified by a string key, only the first time the key is used. This is useful for logging information that's always stable throughout a session, and.

thus would just repeat the same information over and over if it were repeated every time the code path was taken. After a message is logged under a given key, subsequent calls with the same key will do nothing, suppressing the additional redundant copies of the message. Note that the message itself isn't considered when deciding whether or not the repeat should be suppressed - the suppression is based purely on the key. Use this only when you're reasonably certain that the logged information really is unchanging throughout any given session.

Parameters
keyAn arbitrary caller-defined string uniquely identifying the message
messageThe message text to log

◆ Warning()

void DirectOutput.Log.Warning ( string Message)
static

Writes a warning message to the log.

Parameters
MessageThe message.

◆ Write()

void DirectOutput.Log.Write ( string Message)
static

Writes the specified message to the logfile.

Parameters
MessageThe message.

Member Data Documentation

◆ OneTimeLogMessages

HashSet<string> DirectOutput.Log.OneTimeLogMessages = new HashSet<string>()
staticprotected

Property Documentation

◆ Filename

string DirectOutput.Log.Filename
staticgetset

Gets or sets the filename for the log.

The filename.

◆ Instrumentations

string DirectOutput.Log.Instrumentations
staticset

The documentation for this class was generated from the following file:
  • D:/a/DirectOutput/DirectOutput/DirectOutput/Log.cs