You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was thinking of making my log and error system more robust in my game, and I was thinking it would be great that I would use it with GUT, like adding calls to gut.p and asserts to detect errors when loading a concrete scene with GUT for extent (doing e2e tests).
But it seems it can be called only inside a GutTest class (that conflict with my autoload inheritance).
How can I achieve that ?
The text was updated successfully, but these errors were encountered:
I've had this same thought, but the logger resides in addons/gut and when you export you game you shouldn't be including GUT or your tests in the export (not the final project at least). The logger also isn't documented or designed for general consumption, so it might be unwieldy to use. I can't move GUT's logger somewhere else since I don't want to make people install two addons.
Probably a bad idea, but sometimes bad ideas are fun
If you really really really want to try using it though...and this is kinda ugly, and not officially supported...you could:
Create your own logger that has the same methods (with your own implementation) that addons/gut/logger.gd has (or at least all the ones you plan to use.
In an autoload:
Check to see if addons/gut exists, if it does set your global logger to Gut's instance (more on that later)
If addons/gut does not exist, set it to an instance of your own logger.
# your_autoload.gdvarlgr=null# maybe this will have to go in _ready, or maybe it has to go in _init, timing might be weirdfunc_init():
if(FileAccess.file_exists('res://addons/gut/logger.gd')):
lgr=GutUtils.get_instance().get_logger()
else:
lgr=MyLoggerThatActsLikeGutLoggerButIsNot.new()
Maybe if this works, and you really like it, we can explore adding something more formal to GUT...but probably not.
Versions
Godot 4.2.2 with GUT 9.2.1
The Feature
I was thinking of making my log and error system more robust in my game, and I was thinking it would be great that I would use it with GUT, like adding calls to gut.p and asserts to detect errors when loading a concrete scene with GUT for extent (doing e2e tests).
But it seems it can be called only inside a GutTest class (that conflict with my autoload inheritance).
How can I achieve that ?
The text was updated successfully, but these errors were encountered: