Ixian SDK
DLT.Meta.Logging Class Reference

A singleton class which gathers and stores all logging messages from the Ixian executable. It supports log rotation (on restart, or when reaching a certain size), outputting to the console and file simultaneously, automatic timestamping and thread identification. The actual work on the log files is done in a separate thread, so that the caller does not feel a performance impact for logging. More...

Static Public Member Functions

static void start ()
 Initialize and start the logging thread. More...
 
static void stop ()
 Stop the logging thread. More...
 
static void setOptions (int max_log_size=50, int max_log_count=10, bool console_output=true)
 Change log options while logging is active. More...
 
static void log (LogSeverity log_severity, string log_message)
 Sends a message to the log. More...
 
static void roll (bool forceRoll=false)
 Rotates the log file, appending sequential numbers to the old log files and opening a new file. This function will only perform the roll if the file is over the maximum specified size, unless the force parameter is specified. More...
 
static void clear ()
 Removes all the log files from the target directory. More...
 
static int getRemainingStatementsCount ()
 Returns the number of log statements in the Logger's internal cache, waiting to be written to the file. More...
 
static void flush ()
 Pauses execution until all the outstanding log statements are flushed to the file. More...
 
static void trace (string message)
 Sends a message to the log with the implied severity of Trace. More...
 
static void info (string message)
 Sends a message to the log with the implied severity of Info. More...
 
static void warn (string message)
 Sends a message to the log with the implied severity of Warn. More...
 
static void error (string message)
 Sends a message to the log with the implied severity of Error. More...
 
static void trace (string format, params object[] arguments)
 Sends a message to the log with the implied severity of 'Trace'. This function also accepts arguments like the function String.Format(). More...
 
static void info (string format, params object[] arguments)
 Sends a message to the log with the implied severity of 'Info'. This function also accepts arguments like the function String.Format(). More...
 
static void warn (string format, params object[] arguments)
 Sends a message to the log with the implied severity of 'Warn'. This function also accepts arguments like the function String.Format(). More...
 
static void error (string format, params object[] arguments)
 Sends a message to the log with the implied severity of 'Error'. This function also accepts arguments like the function String.Format(). More...
 

Static Public Attributes

static LogSeverity currentSeverity = LogSeverity.trace
 Currently selected log severity. Messages below this severity will not be logged and will be quickly and quietly dropped. More...
 
static bool consoleOutput = true
 If set to true, log output will go to the console, otherwise log will only go to the file. More...
 

Detailed Description

A singleton class which gathers and stores all logging messages from the Ixian executable. It supports log rotation (on restart, or when reaching a certain size), outputting to the console and file simultaneously, automatic timestamping and thread identification. The actual work on the log files is done in a separate thread, so that the caller does not feel a performance impact for logging.

Definition at line 45 of file Logging.cs.

Member Function Documentation

◆ clear()

static void DLT.Meta.Logging.clear ( )
static

Removes all the log files from the target directory.

Definition at line 358 of file Logging.cs.

◆ error() [1/2]

static void DLT.Meta.Logging.error ( string  message)
static

Sends a message to the log with the implied severity of Error.

Parameters
messageLog message.

Definition at line 449 of file Logging.cs.

◆ error() [2/2]

static void DLT.Meta.Logging.error ( string  format,
params object []  arguments 
)
static

Sends a message to the log with the implied severity of 'Error'. This function also accepts arguments like the function String.Format().

Parameters
formatFormat specification. See String.Format()
argumentsOptional arguments.

Definition at line 490 of file Logging.cs.

◆ flush()

static void DLT.Meta.Logging.flush ( )
static

Pauses execution until all the outstanding log statements are flushed to the file.

Definition at line 412 of file Logging.cs.

◆ getRemainingStatementsCount()

static int DLT.Meta.Logging.getRemainingStatementsCount ( )
static

Returns the number of log statements in the Logger's internal cache, waiting to be written to the file.

Returns
Number of waiting statements.

Definition at line 401 of file Logging.cs.

◆ info() [1/2]

static void DLT.Meta.Logging.info ( string  message)
static

Sends a message to the log with the implied severity of Info.

Parameters
messageLog message.

Definition at line 433 of file Logging.cs.

◆ info() [2/2]

static void DLT.Meta.Logging.info ( string  format,
params object []  arguments 
)
static

Sends a message to the log with the implied severity of 'Info'. This function also accepts arguments like the function String.Format().

Parameters
formatFormat specification. See String.Format()
argumentsOptional arguments.

Definition at line 470 of file Logging.cs.

◆ log()

static void DLT.Meta.Logging.log ( LogSeverity  log_severity,
string  log_message 
)
static

Sends a message to the log.

This should almost never be called directly, but rather through one of the helper functions.

Parameters
log_severitySeverity of the log message.
log_messageText to write into the log.

Definition at line 168 of file Logging.cs.

◆ roll()

static void DLT.Meta.Logging.roll ( bool  forceRoll = false)
static

Rotates the log file, appending sequential numbers to the old log files and opening a new file. This function will only perform the roll if the file is over the maximum specified size, unless the force parameter is specified.

When the log is rotated, the current log is appended with the number '1'. If there already exist older log files, they are shifted by one (.1 becomes .2, .2 becomes .3 ...). A maximum number of rotated log files is specified in the logging options and if the rotate results in more files, the extra ones are deleted.

Parameters
forceRollForce log rotation even if the current file is below the threshold.

Definition at line 288 of file Logging.cs.

◆ setOptions()

static void DLT.Meta.Logging.setOptions ( int  max_log_size = 50,
int  max_log_count = 10,
bool  console_output = true 
)
static

Change log options while logging is active.

Parameters
max_log_sizeMaximum log size in megabytes (MB).
max_log_countMaximum number of log files for rotation.
console_outputEnable or disable output to console.

Definition at line 152 of file Logging.cs.

◆ start()

static void DLT.Meta.Logging.start ( )
static

Initialize and start the logging thread.

Definition at line 87 of file Logging.cs.

◆ stop()

static void DLT.Meta.Logging.stop ( )
static

Stop the logging thread.

Definition at line 127 of file Logging.cs.

◆ trace() [1/2]

static void DLT.Meta.Logging.trace ( string  message)
static

Sends a message to the log with the implied severity of Trace.

Parameters
messageLog message.

Definition at line 425 of file Logging.cs.

◆ trace() [2/2]

static void DLT.Meta.Logging.trace ( string  format,
params object []  arguments 
)
static

Sends a message to the log with the implied severity of 'Trace'. This function also accepts arguments like the function String.Format().

Parameters
formatFormat specification. See String.Format()
argumentsOptional arguments.

Definition at line 460 of file Logging.cs.

◆ warn() [1/2]

static void DLT.Meta.Logging.warn ( string  message)
static

Sends a message to the log with the implied severity of Warn.

Parameters
messageLog message.

Definition at line 441 of file Logging.cs.

◆ warn() [2/2]

static void DLT.Meta.Logging.warn ( string  format,
params object []  arguments 
)
static

Sends a message to the log with the implied severity of 'Warn'. This function also accepts arguments like the function String.Format().

Parameters
formatFormat specification. See String.Format()
argumentsOptional arguments.

Definition at line 480 of file Logging.cs.

Member Data Documentation

◆ consoleOutput

bool DLT.Meta.Logging.consoleOutput = true
static

If set to true, log output will go to the console, otherwise log will only go to the file.

Definition at line 69 of file Logging.cs.

◆ currentSeverity

LogSeverity DLT.Meta.Logging.currentSeverity = LogSeverity.trace
static

Currently selected log severity. Messages below this severity will not be logged and will be quickly and quietly dropped.

Definition at line 50 of file Logging.cs.


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