Skip to content

mwseLogger⚓︎

A logging class. Needs to be required before use. See this guide.

Properties⚓︎

includeTimestamp⚓︎

If set to true, all the logged messages will include a timestamp.

Returns:

  • result (boolean)

logToConsole⚓︎

If true, all the logged messages will also be logged to console.

Returns:

  • result (boolean)

name⚓︎

Name of the mod, also counts as unique id of the logger.

Returns:

  • result (string)

Methods⚓︎

assert⚓︎

Assert a condition and log an error if it fails.

myObject:assert(condition, message, ...)

Parameters:

  • condition (boolean)
  • message (string)
  • ... (any): Optional. Formatting arguments. These are passed to string.format.

debug⚓︎

Log debug message.

myObject:debug(message, ...)

Parameters:

  • message (string)
  • ... (any): Optional. Formatting arguments. These are passed to string.format.

doLog⚓︎

Returns true if the messages of the given log level will be logged.

local doLog = myObject:doLog(logLevel)

Parameters:

  • logLevel (mwseLoggerLogLevel): Options are: "TRACE", "DEBUG", "INFO", "WARN", "ERROR" and "NONE".

Returns:

  • doLog (boolean)

error⚓︎

Log error message.

myObject:error(message, ...)

Parameters:

  • message (string)
  • ... (any): Optional. Formatting arguments. These are passed to string.format.

info⚓︎

Log info message.

myObject:info(message, ...)

Parameters:

  • message (string)
  • ... (any): Optional. Formatting arguments. These are passed to string.format.

setLogLevel⚓︎

Set the log level. Options are: "TRACE", "DEBUG", "INFO", "WARN", "ERROR" and "NONE".

myObject:setLogLevel(newLogLevel)

Parameters:

  • newLogLevel (mwseLoggerLogLevel)

setOutputFile⚓︎

Set the output file. If set, logs will be sent to a file of this name.

myObject:setOutputFile(outputFile)

Parameters:

  • outputFile (string)

trace⚓︎

Log trace message.

myObject:trace(message, ...)

Parameters:

  • message (string)
  • ... (any): Optional. Formatting arguments. These are passed to string.format.

warn⚓︎

Log warn message.

myObject:warn(message, ...)

Parameters:

  • message (string)
  • ... (any): Optional. Formatting arguments. These are passed to string.format.