static int RegisterLogCallbackThreaded(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); Application.LogCallback arg0 = null; LuaTypes funcType0 = LuaDLL.lua_type(L, 0); if (funcType0 != LuaTypes.LUA_TFUNCTION) { arg0 = (Application.LogCallback)LuaScriptMgr.GetNetObject(L, 1, typeof(Application.LogCallback)); } else { LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 1); arg0 = (param0, param1, param2) => { int top = func.BeginPCall(); LuaScriptMgr.Push(L, param0); LuaScriptMgr.Push(L, param1); LuaScriptMgr.Push(L, param2); func.PCall(top, 3); func.EndPCall(top); }; } Application.RegisterLogCallbackThreaded(arg0); return(0); }
private void Awake() { //ログハンドラを初期化 LogHandlerDeligate = new Application.LogCallback(LogHandler); Application.logMessageReceived += LogHandlerDeligate; errorCounter = 0; }
public static void RegisterLogCallback(Application.LogCallback Callback, bool CallbackWritesToConsole = false) { if (!ConsoleSystem.RegisteredLogCallback) { if (!object.ReferenceEquals(Callback, null)) { Application.RegisterLogCallback(Callback); ConsoleSystem.RegisteredLogCallback = true; ConsoleSystem.LogCallbackWritesToConsole = CallbackWritesToConsole; ConsoleSystem.LogCallback = Callback; } } else if (Callback == ConsoleSystem.LogCallback) { ConsoleSystem.LogCallbackWritesToConsole = CallbackWritesToConsole; } else if (!object.ReferenceEquals(Callback, null)) { Application.RegisterLogCallback(Callback); ConsoleSystem.LogCallback = Callback; ConsoleSystem.LogCallbackWritesToConsole = CallbackWritesToConsole; } else { Application.RegisterLogCallback(null); int num = 0; ConsoleSystem.RegisteredLogCallback = (bool)num; ConsoleSystem.LogCallbackWritesToConsole = (bool)num; ConsoleSystem.LogCallback = null; } }
/// <summary> /// Initializes exception management within the Unity side /// </summary> public void Init(Action appCrashTest = null) { _appCrashTest = appCrashTest; Application.LogCallback handleException = (message, stackTrace, type) => { if (type == LogType.Exception || type == LogType.Error) { try { if (WinIntegration.Logging.ExceptionLogger.IsEnabled) { WinIntegration.Logging.ExceptionLogger.Send(message, stackTrace); WinIntegration.Logging.ExceptionLogger.IsEnabled = GameController.Instance.GameConfig.ExceptionLoggingAllowed; } } catch (System.Exception ex) { // not sure there's much useful we can do here Debug.LogWarning(string.Format("Failed to handle exception: {0} - because of: {1}", message, ex.Message)); } } }; #if UNITY_5 Application.logMessageReceived += handleException; #else Application.RegisterLogCallback(handleException); #endif }
public static void RegisterLogCallback(string name, UnityUtils.OnUnityLogCallback callback) { if (callback == null) { if (UnityUtils.unityLogCallbacks != null && UnityUtils.unityLogCallbacks.ContainsKey(name)) { UnityUtils.unityLogCallbacks.Remove(name); } } else { if (UnityUtils.unityLogCallbacks == null) { UnityUtils.unityLogCallbacks = new Dictionary <string, UnityUtils.OnUnityLogCallback>(); if (UnityUtils.< > f__mg$cache1 == null) { UnityUtils.< > f__mg$cache1 = new Application.LogCallback(UnityUtils.HandleUnityLog); } Application.logMessageReceived += UnityUtils.< > f__mg$cache1; } if (UnityUtils.unityLogCallbacks.ContainsKey(name)) { UnityUtils.unityLogCallbacks[name] = callback; } else { UnityUtils.unityLogCallbacks.Add(name, callback); } } }
public static BuildOutput CaptureBuildOutput(Func <bool> build) { var result = new BuildOutput(); Application.LogCallback logCallback = (a, b, c) => { if (c == LogType.Log || c == LogType.Warning) { return; } result.LogEntries.Add(new BuildOutput.Entry(a, b, c.ToString())); }; Application.logMessageReceived += logCallback; try { result.IsSuccess = build(); } catch (Exception e) { Debug.LogException(e); result.IsSuccess = false; } finally { Application.logMessageReceived -= logCallback; Debug.Log("[[Writing TempBuildOutput.json]]"); File.WriteAllText("TempBuildOutput.json", JsonConvert.SerializeObject(result)); } return(result); }
private void Awake() { RealtimeSinceStartup = Time.realtimeSinceStartup; oxideMod = Interface.Oxide; EventInfo eventInfo = typeof(Application).GetEvent("logMessageReceived"); if (eventInfo == null) { // Unity 4 FieldInfo logCallbackField = typeof(Application).GetField("s_LogCallback", BindingFlags.Static | BindingFlags.NonPublic); Application.LogCallback logCallback = logCallbackField?.GetValue(null) as Application.LogCallback; if (logCallback == null) { Interface.Oxide.LogWarning("No Unity application log callback is registered"); } #pragma warning disable 0618 Application.RegisterLogCallback((message, stack_trace, type) => { logCallback?.Invoke(message, stack_trace, type); LogMessageReceived(message, stack_trace, type); }); } else { // Unity 5 Delegate handleException = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, "LogMessageReceived"); eventInfo.GetAddMethod().Invoke(null, new object[] { handleException }); } }
private void Awake() { string[] commandLineArgs = Environment.GetCommandLineArgs(); GameSettings.Init(); if (this.HasOption(commandLineArgs, "+connect")) { this.ClientRoutine(commandLineArgs); } else if (this.HasOption(commandLineArgs, "-dedicated")) { if (this.HasOption(commandLineArgs, "-showlogs", SteamDSConfig.ShowLogs)) { ConsoleWriter.Open(); if (CoopDedicatedBootstrap.< > f__mg$cache0 == null) { CoopDedicatedBootstrap.< > f__mg$cache0 = new Application.LogCallback(CoopAdminCommand.Application_logMessageReceived); } Application.logMessageReceived += CoopDedicatedBootstrap.< > f__mg$cache0; SteamDSConfig.ShowLogs = true; } this.ServerRoutine(commandLineArgs); } else { SteamDSConfig.isDedicatedServer = false; CoopPeerStarter.DedicatedHost = false; SteamClientDSConfig.isDedicatedClient = false; Application.LoadLevel("TitleScene"); } }
// Token: 0x06000CB6 RID: 3254 RVA: 0x0003100C File Offset: 0x0002F20C public static void RegisterLogCallback(Application.LogCallback Callback, bool CallbackWritesToConsole = false) { if (global::ConsoleSystem.RegisteredLogCallback) { if (Callback != global::ConsoleSystem.LogCallback) { if (object.ReferenceEquals(Callback, null)) { Application.RegisterLogCallback(null); global::ConsoleSystem.LogCallbackWritesToConsole = (global::ConsoleSystem.RegisteredLogCallback = false); global::ConsoleSystem.LogCallback = null; } else { Application.RegisterLogCallback(Callback); global::ConsoleSystem.LogCallback = Callback; global::ConsoleSystem.LogCallbackWritesToConsole = CallbackWritesToConsole; } } else { global::ConsoleSystem.LogCallbackWritesToConsole = CallbackWritesToConsole; } } else if (!object.ReferenceEquals(Callback, null)) { Application.RegisterLogCallback(Callback); global::ConsoleSystem.RegisteredLogCallback = true; global::ConsoleSystem.LogCallbackWritesToConsole = CallbackWritesToConsole; global::ConsoleSystem.LogCallback = Callback; } }
public UnityEventCollector() { var eventInfo = typeof(Application).GetEvent("logMessageReceivedThreaded", BindingFlags.Static | BindingFlags.Public); // Unity 2017.x+ if (eventInfo == null) { eventInfo = typeof(Application).GetEvent("logMessageReceived", BindingFlags.Static | BindingFlags.Public); } var domainLifetime = Lifetimes.Define(); if (eventInfo != null) { var handler = new Application.LogCallback(ApplicationOnLogMessageReceived); eventInfo.AddEventHandler(null, handler); AppDomain.CurrentDomain.DomainUnload += (EventHandler)((_, __) => { eventInfo.RemoveEventHandler(null, handler); domainLifetime.Terminate(); }); } else { #pragma warning disable 612, 618 Application.RegisterLogCallback(ApplicationOnLogMessageReceived); #pragma warning restore 612, 618 } }
/// <summary> /// 删除日志委托 /// </summary> public static void removeLogCallback(Application.LogCallback cb) { if (EnableLogCallback) { Application.logMessageReceived -= cb; } }
public static void Start() { ourLogEventsCollectorEnabled = PluginSettings.LogEventsCollectorEnabled; if (!ourLogEventsCollectorEnabled) { return; } EditorApplication.update += () => { // can be called only from main thread ourLogEventsCollectorEnabled = PluginSettings.LogEventsCollectorEnabled; if (ourLogEventsCollectorEnabled) { ProcessQueue(); } }; // Both of these methods were introduced in 5.0+ but EditorPlugin.csproj still targets 4.7 var eventInfo = typeof(Application).GetEvent("logMessageReceivedThreaded", BindingFlags.Static | BindingFlags.Public); if (eventInfo == null) { eventInfo = typeof(Application).GetEvent("logMessageReceived", BindingFlags.Static | BindingFlags.Public); } if (eventInfo != null) { var handler = new Application.LogCallback(ApplicationOnLogMessageReceived); eventInfo.AddEventHandler(null, handler); AppDomain.CurrentDomain.DomainUnload += (EventHandler)((_, __) => { eventInfo.RemoveEventHandler(null, handler); }); // Introduced in 3.4, obsolete but still working in 2017.2+ // Should use EditorApplication.playModeStateChanged, introduced in 2017.2 #pragma warning disable 618 EditorApplication.playmodeStateChanged += () => #pragma warning restore 618 { // Work around an issue in Unity 2017.1+ that stops sending log messages to the handler when leaving play mode. // The issue will not be fixed because it might break compatibility of existing workarounds // https://issuetracker.unity3d.com/issues/general-unityengine-dot-application-dot-logmessagereceived-is-not-being-raised-after-exiting-play-mode // Note that although the issue says 2017.4+ it is actually 2017.1 and above. I haven't been able to test 5.x if (!EditorApplication.isPlayingOrWillChangePlaymode) { eventInfo.RemoveEventHandler(null, handler); eventInfo.AddEventHandler(null, handler); } }; } else { #pragma warning disable 612, 618 // Obsolete from 5.0+ Application.RegisterLogCallback(ApplicationOnLogMessageReceived); #pragma warning restore 612, 618 } }
public UnityEventCollector() { if (!PluginSettings.LogEventsCollectorEnabled) { return; } var eventInfo = typeof(Application).GetEvent("logMessageReceivedThreaded", BindingFlags.Static | BindingFlags.Public); // Unity 2017.x+ if (eventInfo == null) { eventInfo = typeof(Application).GetEvent("logMessageReceived", BindingFlags.Static | BindingFlags.Public); } if (eventInfo != null) { var handler = new Application.LogCallback(ApplicationOnLogMessageReceived); eventInfo.AddEventHandler(null, handler); AppDomain.CurrentDomain.DomainUnload += (EventHandler)((_, __) => { eventInfo.RemoveEventHandler(null, handler); }); } else { #pragma warning disable 612, 618 Application.RegisterLogCallback(ApplicationOnLogMessageReceived); #pragma warning restore 612, 618 } }
public static void UnRegisterLogCallback(Application.LogCallback handler) { if (unityLogCallBack.Contains(handler)) { unityLogCallBack.Remove(handler); } }
private void Awake() { this.oxideMod = Interface.get_Oxide(); EventInfo @event = typeof(Application).GetEvent("logMessageReceived"); if (@event != null) { Delegate @delegate = Delegate.CreateDelegate(@event.EventHandlerType, this, "LogMessageReceived"); @event.GetAddMethod().Invoke(null, new object[] { @delegate }); return; } FieldInfo field = typeof(Application).GetField("s_LogCallback", BindingFlags.Static | BindingFlags.NonPublic); Application.LogCallback logCallback1 = (field != null ? field.GetValue(null) : null) as Application.LogCallback; if (logCallback1 == null) { Interface.get_Oxide().LogWarning("No Unity application log callback is registered", new object[0]); } Application.RegisterLogCallback((string message, string stack_trace, LogType type) => { Application.LogCallback logCallback = logCallback1; if (logCallback != null) { logCallback(message, stack_trace, type); } else { } this.LogMessageReceived(message, stack_trace, type); }); }
//! @brief FSMシステム初期化失敗テスト //! @return なし [Test] public void FSMSysmteInitializeFailedTest() { var log = string.Empty; var logMsgRecieved = new Application.LogCallback((condition, stackTrace, type) => { log = condition; }); Application.logMessageReceived += logMsgRecieved; var fsm = new FSMSystem(); fsm.initialize(new IFSMState[] { new FSMTestState(State.Test0, null), new FSMTestState(State.Test0, null), }); Application.logMessageReceived -= logMsgRecieved; var testLog = "State \"" + State.Test0 + "\" is duplicate !!!!!" + "\nFailed initialize FSMSystem ..." ; Assert.AreEqual(testLog, log); }
public static void Init(string appID, CrittercismConfig config) { if (CrittercismAndroid.isInitialized) { Debug.Log("CrittercismAndroid is already initialized."); return; } Debug.Log("Initializing Crittercism with app id " + appID); CrittercismAndroid.mCrittercismsPlugin = new AndroidJavaClass(CrittercismAndroid.CRITTERCISM_CLASS); if (CrittercismAndroid.mCrittercismsPlugin == null) { Debug.Log("CrittercismAndroid failed to initialize. Unable to find class " + CrittercismAndroid.CRITTERCISM_CLASS); return; } using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject @static = androidJavaClass.GetStatic <AndroidJavaObject>("currentActivity")) { CrittercismAndroid.PluginCallStatic("initialize", new object[] { @static, appID, config.GetAndroidConfig() }); } } if (CrittercismAndroid.< > f__mg$cache0 == null) { CrittercismAndroid.< > f__mg$cache0 = new Application.LogCallback(CrittercismAndroid.OnLogMessageReceived); } Application.logMessageReceived += CrittercismAndroid.< > f__mg$cache0; CrittercismAndroid.isInitialized = true; }
// Token: 0x0601564B RID: 87627 RVA: 0x0056D038 File Offset: 0x0056B238 private static void _RegisterExceptionHandler() { try { if (BuglyAgent.< > f__mg$cache0 == null) { BuglyAgent.< > f__mg$cache0 = new Application.LogCallback(BuglyAgent._OnLogCallbackHandler); } Application.RegisterLogCallback(BuglyAgent.< > f__mg$cache0); AppDomain currentDomain = AppDomain.CurrentDomain; if (BuglyAgent.< > f__mg$cache1 == null) { BuglyAgent.< > f__mg$cache1 = new UnhandledExceptionEventHandler(BuglyAgent._OnUncaughtExceptionHandler); } currentDomain.UnhandledException += BuglyAgent.< > f__mg$cache1; BuglyAgent._isInitialized = true; BuglyAgent.DebugLog(null, "Register the log callback in Unity {0}", new object[] { Application.unityVersion }); } catch { } BuglyAgent.SetUnityVersion(); }
public override void OnApplicationStart() { base.OnApplicationStart(); callback = callback ?? new Action <string, string, LogType>(Log); Application.add_logMessageReceived(callback); }
// private static Application.LogCallback callbacks = new Application.LogCallback(delegate (string condition, string stackTrace, LogType type)); public static void RegisterLogCallback(Application.LogCallback callback) { if (Application.unityVersion.StartsWith("4")) { Debug.LogError("This version of TouchConsole Pro is designed to work with Unity 5 and newer only. Reimport the latest version from the asset store to get the Unity 4 version."); } Application.logMessageReceived += callback; }
public static void RemoveLogCallback(Application.LogCallback callback) { if (!_hasRegisterLogCallback) { Application.RegisterLogCallbackThreaded(OnLogCallback); _hasRegisterLogCallback = true; } LogCallbackEvent -= callback; }
public static bool UnregisterLogCallback(Application.LogCallback Callback) { if (!ConsoleSystem.RegisteredLogCallback || !(Callback == ConsoleSystem.LogCallback)) { return(false); } ConsoleSystem.RegisterLogCallback(null, false); return(true); }
// Token: 0x06000CB7 RID: 3255 RVA: 0x000310A4 File Offset: 0x0002F2A4 public static bool UnregisterLogCallback(Application.LogCallback Callback) { if (global::ConsoleSystem.RegisteredLogCallback && Callback == global::ConsoleSystem.LogCallback) { global::ConsoleSystem.RegisterLogCallback(null, false); return(true); } return(false); }
/// <summary> /// 第一次使用时注册,之所以不放到静态构造器,因为多线程问题 /// </summary> /// <param name="callback"></param> private static void AddLogCallback(Application.LogCallback callback) { if (!_hasRegisterLogCallback) { Application.logMessageReceivedThreaded += OnLogCallback; _hasRegisterLogCallback = true; } LogCallbackEvent += callback; }
public static void StaticReset() { if (UnityUtils.meshes != null) { int i = 0; int count = UnityUtils.meshes.Count; while (i < count) { Mesh x = UnityUtils.meshes[i]; if (x != null) { UnityEngine.Object.Destroy(UnityUtils.meshes[i]); } i++; } UnityUtils.meshes = null; } if (UnityUtils.materials != null) { int j = 0; int count2 = UnityUtils.materials.Count; while (j < count2) { Material material = UnityUtils.materials[j]; if (material != null) { UnityEngine.Object.Destroy(material); } j++; } UnityUtils.materials = null; } if (UnityUtils.textures != null) { int k = 0; int count3 = UnityUtils.textures.Count; while (k < count3) { Texture2D texture2D = UnityUtils.textures[k]; if (texture2D != null) { UnityEngine.Object.Destroy(texture2D); } k++; } UnityUtils.textures = null; } if (UnityUtils.unityLogCallbacks != null) { if (UnityUtils.< > f__mg$cache0 == null) { UnityUtils.< > f__mg$cache0 = new Application.LogCallback(UnityUtils.HandleUnityLog); } Application.logMessageReceived -= UnityUtils.< > f__mg$cache0; UnityUtils.unityLogCallbacks = null; } }
private IEnumerator RunTestUnit(UnitState testUnit) { var go = new GameObject(testUnit.unitType.ToString()); go.transform.parent = this.transform; var runner = (TestUnit)go.AddComponent(testUnit.unitType); testUnit.OnRun(runner); Application.LogCallback logReceived = (condition, stackTrace, type) => { if ((type == LogType.Error || type == LogType.Exception) && !TestHelper.UnityInternalError(condition)) { testUnit.unitCases[runner.RunningCase].failedMsg = condition; testUnit.unitCases[runner.RunningCase].failedStack = stackTrace; runner.StopTestCase(runner.RunningCase); } }; Application.logMessageReceived += logReceived; //run test cases foreach (var method in testUnit.unitCases.Keys) { var timeStarted = DateTime.Now; runner.StartTestCase(method); var state = testUnit.unitCases[method]; state.result = CaseState.Result.Run; while (runner.IsRunning) { yield return(null); } state.duration = (float)(DateTime.Now - timeStarted).TotalSeconds; state.result = state.failedMsg == null ? CaseState.Result.Success : CaseState.Result.Fail; //stopped by interruption if (!testUnit.isRunning) { break; } } yield return(new WaitForSeconds(0.5f)); Application.logMessageReceived -= logReceived; //finish test cases GameObject.Destroy(go); testUnit.OnEnd(); //output report ReportXml(testUnit); }
private void ServerRoutine(string[] args) { SteamDSConfig.isDedicatedServer = true; CoopPeerStarter.DedicatedHost = true; SteamClientDSConfig.isDedicatedClient = false; SteamDSConfig.ConfigFilePath = this.GetStringArg(args, "-configfilepath", SteamDSConfig.ConfigFilePath); SteamDSConfig.noSteamClient = this.HasOption(args, "-nosteamclient"); SteamDSConfig.useLaunchDisplay = this.HasOption(args, "-usedisplay"); if (this.HasOption(args, "-showlogs", SteamDSConfig.ShowLogs)) { ConsoleWriter.Open(); if (CoopDedicatedBootstrap.< > f__mg$cache0 == null) { CoopDedicatedBootstrap.< > f__mg$cache0 = new Application.LogCallback(CoopAdminCommand.Application_logMessageReceived); } Application.logMessageReceived += CoopDedicatedBootstrap.< > f__mg$cache0; SteamDSConfig.ShowLogs = true; } Debug.Log("Starting dedicated server"); SteamDSConfig.ServerAddress = this.GetStringArg(args, "-serverip", SteamDSConfig.ServerAddress); SteamDSConfig.ServerSteamPort = this.GetShortArg(args, "-serversteamport", SteamDSConfig.ServerSteamPort); SteamDSConfig.ServerGamePort = this.GetShortArg(args, "-servergameport", SteamDSConfig.ServerGamePort); SteamDSConfig.ServerQueryPort = this.GetShortArg(args, "-serverqueryport", SteamDSConfig.ServerQueryPort); SteamDSConfig.ServerPlayers = this.GetIntArg(args, "-serverplayers", SteamDSConfig.ServerPlayers); SteamDSConfig.ServerName = this.GetStringArg(args, "-servername", SteamDSConfig.ServerName); SteamDSConfig.ServerPassword = this.GetPasswordArg(args, "-serverpassword", SteamDSConfig.ServerPassword); SteamDSConfig.ServerAdminPassword = this.GetPasswordArg(args, "-serverpassword_admin", SteamDSConfig.ServerAdminPassword); SteamDSConfig.ServerSteamAccount = this.GetStringArg(args, "-serversteamaccount", SteamDSConfig.ServerSteamAccount); SteamDSConfig.GameAutoSaveIntervalMinutes = this.GetIntArg(args, "-serverautosaveinterval", SteamDSConfig.GameAutoSaveIntervalMinutes); SteamDSConfig.ServerVACEnabled = this.HasOption(args, "-enableVAC", SteamDSConfig.ServerVACEnabled); SteamDSConfig.GameType = this.GetStringArg(args, "-inittype", SteamDSConfig.GameType); SteamDSConfig.GameDifficulty = this.GetStringArg(args, "-difficulty", SteamDSConfig.GameDifficulty); SteamDSConfig.GameSaveSlot = this.GetIntArg(args, "-slot", SteamDSConfig.GameSaveSlot); SteamDSConfig.SaveFolderPath = this.GetStringArg(args, "-savefolderpath", SteamDSConfig.SaveFolderPath); SteamDSConfig.VeganMode = this.HasOption(args, "-veganmode", SteamDSConfig.VeganMode); SteamDSConfig.VegetarianMode = this.HasOption(args, "-vegetarianmode", SteamDSConfig.VegetarianMode); SteamDSConfig.ResetHolesMode = this.HasOption(args, "-resetholesmode", SteamDSConfig.ResetHolesMode); SteamDSConfig.TreeRegrowMode = this.HasOption(args, "-treeregrowmode", SteamDSConfig.TreeRegrowMode); SteamDSConfig.AllowBuildingDestruction = this.HasOption(args, "-allowbuildingdestruction", SteamDSConfig.AllowBuildingDestruction); SteamDSConfig.AllowEnemiesCreative = this.HasOption(args, "-allowenemiescreative", SteamDSConfig.AllowEnemiesCreative); SteamDSConfig.AllowCheats = this.HasOption(args, "-allowcheats", SteamDSConfig.AllowCheats); this.ApplyCheatsAndOptions(); SteamDSConfig.UseServerConfigFile = false; if (SteamDSConfig.useLaunchDisplay) { this.showServerData(); } else { this.LaunchDSServer(); } }
static Application.LogCallback GetUnityLogCallback(LogCallback callback) { Application.LogCallback unityCallback = (c, s, type) => { LogLevel logLevel; if (type == LogType.Error) logLevel = LogLevel.Error; else if (type == LogType.Warning) logLevel = LogLevel.Warning; else logLevel = LogLevel.Info; OnLogCallback(c, s, logLevel); }; return unityCallback; }
public static Delegate Application_LogCallback(LuaFunction func) { Application.LogCallback d = (param0, param1, param2) => { int top = func.BeginPCall(); IntPtr L = func.GetLuaState(); LuaScriptMgr.Push(L, param0); LuaScriptMgr.Push(L, param1); LuaScriptMgr.Push(L, param2); func.PCall(top, 3); func.EndPCall(top); }; return(d); }
public Init( TagInstance <ErrorsInYourFace> binding, int queueSize = DEFAULT_QUEUE_SIZE, IImmutableSet <LogType> handledTypes = null ) { this.handledTypes = handledTypes ?? DEFAULT_HANDLED_TYPES; this.queueSize = queueSize; entries = new LinkedList <string>(); this.binding = binding.instance; logCallback = logMessageHandlerThreaded; initBinding(binding.instance); setText(); hide(); }
public void InitRunner(List<TestComponent> tests, List<string> dynamicTestsToRun) { m_CurrentlyRegisteredLogCallback = GetLogCallbackField(); m_LogCallback = LogHandler; Application.RegisterLogCallback(m_LogCallback); // Init dynamic tests foreach (var typeName in dynamicTestsToRun) { var t = Type.GetType(typeName); if (t == null) continue; var scriptComponents = Resources.FindObjectsOfTypeAll(t) as MonoBehaviour[]; if (scriptComponents.Length == 0) { Debug.LogWarning(t + " not found. Skipping."); continue; } if (scriptComponents.Length > 1) Debug.LogWarning("Multiple GameObjects refer to " + typeName); tests.Add(scriptComponents.First().GetComponent<TestComponent>()); } // create test structure m_TestComponents = ParseListForGroups(tests).ToList(); // create results for tests m_ResultList = m_TestComponents.Select(component => new TestResult(component)).ToList(); // init test provider m_TestsProvider = new IntegrationTestsProvider(m_ResultList.Select(result => result.TestComponent as ITestComponent)); m_ReadyToRun = true; }
private static void RegisterLogCallback(Application.LogCallback handler, bool threaded) { if (Application.s_RegisterLogCallbackDeprecated != null) { Application.logMessageReceived -= Application.s_RegisterLogCallbackDeprecated; Application.logMessageReceivedThreaded -= Application.s_RegisterLogCallbackDeprecated; } Application.s_RegisterLogCallbackDeprecated = handler; if (handler != null) { if (threaded) { Application.logMessageReceivedThreaded += handler; } else { Application.logMessageReceived += handler; } } }