SkyProc

Skyrim Mod:SkyProc/How to List/DebugLogs

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Related SkyProc Classes[edit]

  • SPGlobal - A collection of global objects/settings for SkyProc.

How To[edit]

Create Debug logs[edit]

NOTE: If you are using SkyProc's starter program, this is already done for you. This tutorial is only for programmers starting a project from scratch.

SkyProc has a lot of built in debug messages and logs meant to help debug your code and locate import/export errors. By default, SkyProc will output no debug messages, but they can be easily enabled.

SPGlobal.createGlobalLog();

Do this early on, before you do any importing, and you'll see a special SkyProcDebug/ folder is automatically created in the same directory as your patch, and filled with many logs detailing the specifics of the import/export.


Print Debug Logs[edit]

The simplest log to use is the asynchronous log (as opposed to the synchronous log used by SkyProc's internals).

SPGlobal.log("Title", "Message");

You will see the message inside the asynchronous log.

Splitting up the Asynchronous Log into Several Sections[edit]

Sometimes your program has a few "stages" of code, and you might want to split each stage up into its own log for easy viewing. (see Automatic Variant's log setup)

To do this, you can create a new asynchronous log at the start of each stage:

// This is a start of a new stage of your code, so you want all asynchronous logs to be sent to a new file
SPGlobal.newLog("The new log name");

After this, all asynchronous log messages will be sent to this new log file.


Setting up truly separate log files[edit]

Sometimes you want specialized log files that can accept a log at any time. SkyProc itself uses this method for Blocked Records log.

To do this, you first need to declare/create the log:

// Special logs use enums to differentiate which log you want to print to
// So just declare one for yourself
enum LogEnum {
   SpecialLog;
}

// Then use the enum you created, and specify a filename
SPGlobal.newSpecialLog(LogEnum.SpecialLog, "Special Log");

// Now you can print to that special log anytime using:
SPGlobal.logSpecial(LogEnum.SpecialLog, "Title", "Message");