Log
Functions
Section titled “Functions”getParentFunctionDescription()
Section titled “getParentFunctionDescription()”getParentFunctionDescription(
this,levels?):string|undefined
Defined in: packages/isaacscript-common/src/functions/log.ts:13
Helper function to get the name and the line number of the current calling function.
For this function to work properly, the “–luadebug” flag must be enabled. Otherwise, it will always return undefined.
Parameters
Section titled “Parameters”void
levels?
Section titled “levels?”number = 3
Optional. The amount of levels to look backwards in the call stack. Default is 3 (because the first level is this function, the second level is the calling function, and the third level is the parent of the calling function).
Returns
Section titled “Returns”string | undefined
log(
this,msg,includeParentFunction?):void
Defined in: packages/isaacscript-common/src/functions/log.ts:56
Helper function to avoid typing out Isaac.DebugString().
If you have the “–luadebug” launch flag turned on, then this function will also prepend the function name and the line number before the string, like this:
[INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.Subsequently, it is recommended that you turn on the “–luadebug” launch flag when developing your mod so that debugging becomes a little bit easier.
Parameters
Section titled “Parameters”void
string | number
The message to log.
includeParentFunction?
Section titled “includeParentFunction?”boolean = true
Optional. Whether to prefix the message with the function name and line number, as shown in the above example. Default is true.
Returns
Section titled “Returns”void
logAndPrint()
Section titled “logAndPrint()”logAndPrint(
msg):void
Defined in: packages/isaacscript-common/src/functions/log.ts:79
Helper function to log a message to the “log.txt” file and to print it to the screen at the same time.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
logError()
Section titled “logError()”logError(
this,msg):void
Defined in: packages/isaacscript-common/src/functions/log.ts:90
Helper function to log an error message and also print it to the console for better visibility.
This is useful in situations where using the error function would be dangerous (since it
prevents all of the subsequent code in the callback from running).
Parameters
Section titled “Parameters”void
string
Returns
Section titled “Returns”void
