Line 15: | Line 15: | ||
==Your first log== | ==Your first log== | ||
Logging somthing in GLog is as easy as this: | |||
<syntaxhighlight lang="c#" line="1" start="1"> | <syntaxhighlight lang="c#" line="1" start="1"> | ||
using GLogUnity; | using GLogUnity; | ||
Line 21: | Line 21: | ||
GLog.StartSession(); | GLog.StartSession(); | ||
GLog.Log(VerboseLevel.DEBUG, "tag1", "tag2", "data"); | GLog.Log(VerboseLevel.DEBUG, "tag1", "tag2", "data"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 12:23, 17 April 2020
This page describes how to set up and use the GURaaS logging plugin for unity.
installing the plugin
- Download the plugin unity asset TODO: download link.
- Import the plugin into unity (Assets -> Import Package -> Custom Package...).
- Your project should now have the following additional assets:
- Select the GLogConfig asset and set the Game Unique Id to the Id assigned to the game on the GURaaS portal.
- The plugin is now set up and ready to use!
Your first log
Logging somthing in GLog is as easy as this:
using GLogUnity;
GLog.StartSession();
GLog.Log(VerboseLevel.DEBUG, "tag1", "tag2", "data");
Plugin structure
The plugin consists of three important components:
GLog
The GLog file is a ScriptableObject that contains the settings for your game and functions as a central point for any interaction with the plugin.
When using the plugin your asset folder should have a single GLog asset (called GLogConfig) in a Resources folder. When unpacking the plugin a GLog asset is placed in the Resources folder.
GLogChannel
A channel is a ScriptableObject that listens to the logs passed to GLog and passes any logs that match its verbosity mask to an output. The plugin comes with 3 different types of channels, but more can be added by extending the GLogChannel class. The default channels are:
- File channel: outputs received logs to the file location specified.
- Console channel: outputs received logsto the Unity console.
- GURaaS channel (or remote channel): sends received logs to the GURaaS server.
A game can have multiple channels, but only channels that are referenced in the GLogConfig will be used.
The plugin includes one existing channel asset for each of the default types, these can be found in the Resources folder.
GLogMonitor
Because GLog and GLogChannel are both ScriptableObjects they are not part of the scenes and don't receive updates. This is why the first call GLog creates a GLogMonitor in the scene and adds it to DontDestroyOnLoad. The GLogMonitor passes updates to the other components and handles any networking.
Users should never need to access the GLogMonitor directly, but it is good to know its function.