Skip to main content

Debugging

The SDK is designed to be as silent as possible and use very few resources. You will therefore not get much information by default in your development console.

We have 2 different debug log types that can be enabled / disabled at any time:

  • info log
  • verbose log

Both can be switched on from game.project so they are active from the moment the SDK starts:

[gameanalytics]
enable_info_log = 1
enable_verbose_log = 1

Info Log​

Short messages will be output when enabled explaining when some action is being performed by the SDK. Sometimes cropping text / values to make it more readable.

gameanalytics.setEnabledInfoLog(true)
Info/GameAnalytics: Add DESIGN event: {eventId:someEvent, value:0}
Info/GameAnalytics: Add DESIGN event: {eventId:someOtherEvent, value:100}
Info/GameAnalytics: Add ERROR event: {severity:info, message:This is some in}
warning

Enable info log when implementing the SDK, and remember to turn it off in production!

Verbose Log​

Console output when each event is added, with all fields in JSON format. This is exactly the data being submitted to the GameAnalytics servers for each event, so it is the quickest way to check that an event is validated and contains what you expect.

gameanalytics.setEnabledVerboseLog(true)

This can result in a lot of text. When troubleshooting events it is recommended to enable it only around the action that needs inspection:

-- enable verbose log
gameanalytics.setEnabledVerboseLog(true)

-- add the event you need to inspect
gameanalytics.addDesignEvent({
eventId = "Some:Event",
value = 100,
})

-- disable verbose log
gameanalytics.setEnabledVerboseLog(false)

Log file save location​

On desktop platforms the SDK keeps its local event queue and log files in a folder of its own:

  • Windows: %LOCALAPPDATA%/GameAnalytics
  • macOS: ~/GameAnalytics
  • Linux: ~/GameAnalytics

To use a different folder, set the writable path per platform in game.project. The folder must exist, the SDK only creates its own subfolder in it. $VAR, ${VAR}, %VAR% and a leading ~ are expanded:

[gameanalytics]
write_path_osx = $HOME/MyGame
write_path_windows = %APPDATA%/MyGame
write_path_linux = $HOME/MyGame

Event queue​

Whenever an event is added (and validated) it is stored in a local database queue. Every 8 seconds the SDK submits the events queued since the last submit. The payload is gzipped, so it only consumes a small amount of bandwidth.

info

When the device is offline the events are still added to the queue. They are submitted once the device is online again.

Thread handling​

Submitting the queue happens on a dedicated low-priority background thread, so it has minimal impact on performance and does not cause UI lag or sudden spikes. The queue executes its tasks sequentially: adding an event or submitting the queued events each run in turn, and a task is finished before the next one starts.

On desktop platforms the extension ends the session, flushes the remaining events and stops the background thread when the game quits, so no extra call is needed.