Log - Kirix Documentation

Developer Resources

Log

Overview

The Log Class allows applications to log debug, informational, and error information that is produced during the course of execution of a script. Log entries can have different levels of severity. There are five different levels, in order of least severe to most severe: Debug, Info, Warn, Error, and Fatal. The log output may optionally be filtered, so that only desired error levels are placed into the output log file.

Constructor

Log(filename : String)

Arguments

filename
Optionally, the filename may be directly specified here

Methods

Log.close
Closes the log file
Log.debug
Adds a debug output line to the log
Log.erase
Truncates the log file to zero lines
Log.error
Adds a error output line to the log
Log.fatal
Adds a fatal output line to the log
Log.info
Adds an information output line to the log
Log.open
Opens a log file for appending
Log.setConsoleOutput
Activates or deactivates console output
Log.setFilterLevel
Sets the filter level for the log output
Log.warn
Adds a warning output line to the log

Log.close

function Log.close() : Boolean

Returns

True upon success, false otherwise

Description

Closes the log file

Log.debug

function Log.debug() : Boolean

Returns

True upon success, false otherwise

Description

Adds a debug output line to the log

Log.erase

function Log.erase() : Boolean

Returns

True upon success, false otherwise

Description

Calling Log.erase() truncates the log file to zero lines. This is useful for resetting the log file for a new set of output.

Log.error

function Log.error() : Boolean

Returns

True upon success, false otherwise

Description

Adds an error output line to the log

Log.fatal

function Log.fatal() : Boolean

Returns

True upon success, false otherwise

Description

Adds a fatal output line to the log

Log.info

function Log.info() : Boolean

Returns

True upon success, false otherwise

Description

Adds an information output line to the log

Log.open

function Log.open(filename : String) : Boolean

Returns

True upon success, false if the open operation failed

Description

Calling open() opens a log file for appending. If the log file does not already exist, it is created. If it already exists, it it appended to, not truncated.

Log.setConsoleOutput

function Log.setConsoleOutput(new_val : Boolean)

Arguments

new_val
New setting of the console output option. The default value is true.

Description

If setConsoleOutput() is activated, all log lines that appear in the log file also appear in console output.

Log.setFilterLevel

function Log.setFilterLevel(level : Integer) : Undefined

Arguments

level
A bitmask representing the log levels desired for the output file. The value may be one or a combination of the following: LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error, or LogLevel.Fatal. All values can be specified at once using LogLevel.All

Returns

Undefined

Description

Calling setFilterLevel() enables you to direct the log class to only output certain log entries. For instance, calling setLogLevel with the Log.LevelDebug parameter would cause only subsequent debug() messages to be inserted into the log output file. These levels may be combined with a bitwise or mask.

Log.warn

function Log.warn() : Boolean

Returns

True upon success, false otherwise

Description

Adds a warning output line to the log