Do not package this file with your mod though because that would lead to conflicts with other scripts.
Example usage
@wrapMethod(EquipmentSystemPlayerData)funcOnRestored() ->Void {wrappedMethod(); // call the original functionLogChannel(n"DEBUG", "Player Initialized"); // create a log output}
Where does it go?
Improve logging
You can use the function FTLog to create logs with your mod's name as a prefix. It will make it easier for you to go over your logs and filter them:
importCodeware.*importMyMod.Logger.*classCrazyService extends ScriptableService {private cb funcOnLoad() {MyLog("Psycho stuff!");MyLogWarn("Psycho stuff!");MyLogError("Psycho stuff!"); }}// It will log something like:// ... [MyMod] Psycho stuff!// ... [MyMod] Psycho stuff! // Colored in Game Log// ... [MyMod] Psycho stuff! // Colored in Game Log
We can even improve on this with Codeware. It provides the function GetStackTrace so we can deduce the class and function where our logging function is executed:
This is convenient as you don't have to worry when you copy/paste this line in another function. The class and function name will be deduced for you. It also works when using a global function.
You can improve this function to list more entries of the stack trace. This is up to you to implement it if you want. An other alternative worth checking is to use redscript-dap, a debugger which integrates with VS Code.