Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Logging Debug Output: Sending Debug.Log() Output to Loggly
public class LogOutputHandler : MonoBehaviour {
//Register the HandleLog function on scene start to fire on debug.log events
void Awake(){
//Create a string to store log level in
string level = "";
//Capture debug.log output, send logs to Loggly
public void HandleLog(string logString, string stackTrace, LogType type) {
//Initialize WWWForm and store log level as a string
level = type.ToString ();
var loggingForm = new WWWForm();
//Add log message to WWWForm
loggingForm.AddField("LEVEL", level);
loggingForm.AddField("Message", logString);
loggingForm.AddField("Stack_Trace", stackTrace);
//Add any Game or Device MetaData that would be useful to finding issues later
loggingForm.AddField("Device_Model", SystemInfo.deviceModel);
//Send WWW Form to Loggly
var sendLog = new WWW("", loggingForm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment