Ixian SDK
IXICore.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 (string path)
 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 42 of file Logging.cs.

Member Function Documentation

◆ clear()

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

Removes all the log files from the target directory.

Definition at line 356 of file Logging.cs.

◆ error() [1/2]

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

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

Parameters
messageLog message.

Definition at line 447 of file Logging.cs.

◆ error() [2/2]

static void IXICore.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 488 of file Logging.cs.

◆ flush()

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

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

Definition at line 410 of file Logging.cs.

◆ getRemainingStatementsCount()

static int IXICore.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 399 of file Logging.cs.

◆ info() [1/2]

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

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

Parameters
messageLog message.

Definition at line 431 of file Logging.cs.

◆ info() [2/2]

static void IXICore.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 468 of file Logging.cs.

◆ log()

static void IXICore.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 165 of file Logging.cs.

◆ roll()

static void IXICore.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 285 of file Logging.cs.

◆ setOptions()

static void IXICore.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 149 of file Logging.cs.

◆ start()

static void IXICore.Meta.Logging.start ( string  path)
static

Initialize and start the logging thread.

Definition at line 84 of file Logging.cs.

◆ stop()

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

Stop the logging thread.

Definition at line 124 of file Logging.cs.

◆ trace() [1/2]

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

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

Parameters
messageLog message.

Definition at line 423 of file Logging.cs.

◆ trace() [2/2]

static void IXICore.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 458 of file Logging.cs.

◆ warn() [1/2]

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

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

Parameters
messageLog message.

Definition at line 439 of file Logging.cs.

◆ warn() [2/2]

static void IXICore.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 478 of file Logging.cs.

Member Data Documentation

◆ consoleOutput

bool IXICore.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 66 of file Logging.cs.

◆ currentSeverity

LogSeverity IXICore.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 47 of file Logging.cs.


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