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, formatValues)
Parameters:
condition
(boolean)message
(string)formatValues
(variadic): Optional. Formatting and additional parameters matching string.format's usage.
debug
⚓︎
Log debug message.
myObject:debug(message, formatValues)
Parameters:
message
(string)formatValues
(variadic): Optional. Formatting and additional parameters matching string.format's usage.
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, formatValues)
Parameters:
message
(string)formatValues
(variadic): Optional. Formatting and additional parameters matching string.format's usage.
info
⚓︎
Log info message.
myObject:info(message, formatValues)
Parameters:
message
(string)formatValues
(variadic): Optional. Formatting and additional parameters matching string.format's usage.
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, formatValues)
Parameters:
message
(string)formatValues
(variadic): Optional. Formatting and additional parameters matching string.format's usage.
warn
⚓︎
Log warn message.
myObject:warn(message, formatValues)
Parameters:
message
(string)formatValues
(variadic): Optional. Formatting and additional parameters matching string.format's usage.