Logging Interface

Interface to receive log messages from the Epic Online Services SDK

2 mins to read

The Logging Interface gives developers access to useful output from the Epic Online Services (EOS) SDK that can help to diagnose technical issues both during development and after shipping a product. Unlike other interfaces in the EOS SDK, the Logging Interface does not communicate with remote machines, and does not require a handle.

Receiving Log Data

To receive log output from the EOS SDK, register a callback function (of type EOS_LogMessageFunc) by passing it to the EOS_Logging_SetCallback function. Whenever another Interface produces log output, your function will receive an EOS_LogMessage data structure containing the relevant data. EOS manages the memory for this data, and can delete it at any time following the end of the callback function, so you must make your own copy of any information you want to keep past the callback function's lifetime.

Filtering Log Data

The Logging Interface features a built-in filtering system that can help you focus quickly and easily on the information you need. All logs generated by EOS have a category that indicates which subsystem or interface created them, and a "verbosity" level indicating the log's overall importance. You can filter messages from any category, or all categories, such that only those at or below a given verbosity level will trigger your callback function. To do this, call EOS_Logging_SetLogLevel with the category (using EOS_ELogCategory) and the verbosity level (using EOS_ELogLevel). You can also set the level for all categories at once, and can filter one or more categories out entirely. The following code snippet shows a few examples:

// Set all categories to Warning level; ignore anything that isn't at least as important as a Warning.
EOS_Logging_SetLogLevel(EOS_LC_ALL_CATEGORIES, EOS_LOG_Warning);
// For the Friends Interface, restrict it a little more; we only want things that are at or above Error level, no Warnings.
EOS_Logging_SetLogLevel(EOS_LC_Friends, EOS_LOG_Error);
// Report everything from the Ecom Interface. This might be something we're currently debugging, so we want all the log information we can get.
EOS_Logging_SetLogLevel(EOS_LC_Ecom, EOS_LOG_VeryVerbose);
// We don't want log output from the Lobby Interface, so turn it off completely.
EOS_Logging_SetLogLevel(EOS_LC_Lobby, EOS_LOG_Off);

By default, all categories report all log data to the callback function.