Application.LogCallback Manual     Reference     Scripting  
Scripting > Runtime Classes > Application
Application.LogCallback

delegate LogCallback (condition : String, stackTrace : String, type : LogType) : void

Description

Use this delegate type with RegisterLogCallback to monitor what gets logged.

JavaScript
var output = "";
var stack= "";

function OnEnable () {
Application.RegisterLogCallback(HandleLog);
}

function OnDisable () {
// Remove callback when object goes out of scope
Application.RegisterLogCallback(null);
}

function HandleLog (logString : String, stackTrace : String, type : LogType) {
output = logString;
stack = stackTrace;
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
public string output = "";
public string stack = "";
void OnEnable() {
Application.RegisterLogCallback(HandleLog);
}
void OnDisable() {
Application.RegisterLogCallback(null);
}
void HandleLog(string logString, string stackTrace, LogType type) {
output = logString;
stack = stackTrace;
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

public output as string =

public stack as string =


def OnEnable():
Application.RegisterLogCallback(HandleLog)

def OnDisable():
Application.RegisterLogCallback(null)

def HandleLog(logString as string, stackTrace as string, type as LogType):
output = logString
stack = stackTrace

See Also: Application.RegisterLogCallback, LogType