Murl Engine Lua Addon API  Version 1.0 beta
Murl.System.Console

The console printing class.

The console prints to std::printf or ANDROID_LOG_INFO.

The console class has serveral static methods to print without a class context e.g. System::Console::Print().

An instance of the console class can print three levels:

  • The information level.
  • The warning level.
  • The error level.

Printing a message supports:

  • A customizable prefix string for each level.
  • A customizable global prefix string.
  • Nested sections with customizable indentation width and character.
  • Suppress printing by setting the current print level.

The output string is: [global prefix]" "[indent string][level prefix]" "[message].


Table members

Enumerations


Level

Definition of the print levels. Use GetLevel() to get the current level.

Murl.System.Console.QUIETDo not print.
Murl.System.Console.ERRORPrint errors only.
Murl.System.Console.WARNINGPrint errors and warnings.
Murl.System.Console.INFOPrint errors, warnings and infos.
Murl.System.Console.MAX_LEVELS


Functions


Murl.System.Console.Print(message)

Print a string.

Boolean Print(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if successful.

Murl.System.Console.PrintEndline(message)

Print a string including an end-of-line character at the end of the string.

Boolean PrintEndline(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if successful.

Murl.System.Console.PrintHex(data, bytesPerLine)

Print the hex dump of a data object.

Boolean PrintHex(Murl.ConstData data, Integer bytesPerLine)

Parameters
dataThe data object to print.
bytesPerLineThe the number of source bytes per line.
Returns
Boolean true if successful.

Murl.System.Console.new()

The default constructor.

Murl.System.Console new()

Returns
Murl.System.Console

Murl.System.Console.new(globalPrefix)

Constructor taking a global prefix string.

Murl.System.Console new(String globalPrefix)

Parameters
globalPrefixThe global prefix string.
Returns
Murl.System.Console


Methods


SetLevel(level)

Set the current print level.

Boolean SetLevel(Murl.System.Console.Level level)

Parameters
levelThe current print level.
Returns
Boolean true if successful, false if level is invalid.

GetLevel()

Get the current print level.

Murl.System.Console.Level GetLevel()

Returns
Murl.System.Console.Level The current print level.

SetIndentWidth(indentWidth)

Set the number of indent characters per section. The default number of indent characters is 2. The indent string contains the indent character (GetIndentWidth() * GetCurrentSection()) times. The indent string is printed for each message.

SetIndentWidth(Integer indentWidth)

Parameters
indentWidthThe number of indent characters per section, a width of zero disables indentation.

GetIndentWidth()

Get the number of indent characters per section.

Integer GetIndentWidth()

Returns
Integer The number of indent characters per section.

SetIndentChar(indentChar)

Set the indent character. The default indent character is a space. The indent string contains the indent character (GetIndentWidth() * GetCurrentSection()) times. The indent string is printed for each message.

SetIndentChar(Char indentChar)

Parameters
indentCharThe indent character.

GetIndentChar()

Get the indent character.

Char GetIndentChar()

Returns
Char The indent character.

SetGlobalPrefix(prefix)

Set the global prefix string. The global prefix string is printed for each message including a trailing space character.

SetGlobalPrefix(String prefix)

Parameters
prefixThe global prefix string.

GetGlobalPrefix()

Get the global prefix string.

String GetGlobalPrefix()

Returns
String The global prefix string.

SetInfoPrefix(prefix)

Set the info prefix string. The info prefix string is printed for info messages including a trailing space character.

SetInfoPrefix(String prefix)

Parameters
prefixThe info prefix string.

GetInfoPrefix()

Get the info prefix string.

String GetInfoPrefix()

Returns
String The info prefix string.

SetWarningPrefix(prefix)

Set the warning prefix string. The warning prefix string is printed for warning messages including a trailing space character.

SetWarningPrefix(String prefix)

Parameters
prefixThe warning prefix string.

GetWarningPrefix()

Get the warning prefix string.

String GetWarningPrefix()

Returns
String The warning prefix string.

SetErrorPrefix(prefix)

Set the error prefix string. The error prefix string is printed for error messages including a trailing space character.

SetErrorPrefix(String prefix)

Parameters
prefixThe error prefix string.

GetErrorPrefix()

Get the error prefix string.

String GetErrorPrefix()

Returns
String The error prefix string.

GetCurrentSection()

Get the current section. The currend section is incremented by BeginInfo() and decremented by EndInfo(). The current section is used for indentation only, see SetIndentChar() and SetIndentWidth().

Integer GetCurrentSection()

Returns
Integer The current section.

GetCurrentIndentString()

Get the current indent string. The indent string contains the indent character (GetIndentWidth() * GetCurrentSection()) times. The indent string is printed for each message.

String GetCurrentIndentString()

Returns
String The current indent string.

BeginSection()

Begin a section. Increments the current section.

Boolean BeginSection()

Returns
Boolean true if successful.

BeginSection(message)

Begin a section and print a string. The message is printed before incrementing the current section.

Boolean BeginSection(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if successful.

EndSection()

End a section. Decrements the current section.

Boolean EndSection()

Returns
Boolean true if successful.

EndSection(message)

End a section and print a string. The message is printed after decrementing the current section.

Boolean EndSection(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if successful.

PrintInfo(message)

Print a string at info level.

Boolean PrintInfo(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if info level is enabled.

PrintWarning(message)

Print a string at warning level.

Boolean PrintWarning(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if warning or info level is enabled.

PrintError(message)

Print a string at error level.

Boolean PrintError(String message)

Parameters
messageThe message string to print.
Returns
Boolean true if error, warning or info level is enabled.