ianpatt / sfse

Starfield Script Extender

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use the Logger?

Tautellini opened this issue · comments

So, this might be a dumb question in the end. But how are you supposed to use the new Logger? In SKSE it was an interface right? If I also intend to use the static functions, how is it - supposed - to work?

Because when I just call DebugLog::openRelative in my SFSEPlugin_Load method and call one of the message methods afterwards, I wont get any log written because I would need to flush.

However, if I actually call DebugLog::flush() the plugin would fail to load for whatever reason.

What I wrote:

DebugLog::openRelative(CSIDL_MYDOCUMENTS, "\\My Games\\" SAVE_FOLDER_NAME "\\SFSE\\Logs\\sfse-plugin-weaponfov.txt");

_MESSAGE("WeaponFoVPlugin loaded");

DebugLog::flush();

Will end in an exception when the plugin is being loaded. I have yet to debug what exactly the exception is tho. But maybe Im doing something fundamentally wrong in the first place.

I also tried making an own instance from the DebugLog class, something like:

DebugLog* logger = new DebugLog();
logger->openRelative(CSIDL_MYDOCUMENTS, "\\My Games\\" SAVE_FOLDER_NAME "\\SFSE\\Logs\\sfse-plugin-weaponfov.txt");

However, I also run into failures when trying to flush that one.

Im pretty newbish with C++ in general, but would appreciate any help to get me to the right direction.

One more question: Is there some kind of Discord/Slack group that you maintain, or some kind of community Discord around the development of Script Extender Plugins?

The debug logger was never an interface; plugins should be logging to their own files. You also generally don't need to flush unless the game is going to crash. I would suggest using a debugger.

Do not try and make another instance of DebugLog; all of the members are static.