public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs x) { WriteToLog.Log("An unhandled exception was thrown", "UNHANDLEDEXCEPTION"); var ex = (Exception)x.ExceptionObject; WriteToLog.Log(ex.Message, "UNHANDLEDEXCEPTION"); WriteToLog.Log(ex.ToString(), "UNHANDLEDEXCEPTION"); }
public static void CurrentDomain_FirstChanceException(object sender, FirstChanceExceptionEventArgs e) { if (e.Exception is InvalidCastException || e.Exception is System.Collections.Generic.KeyNotFoundException) { return; } WriteToLog.Log("A first chance exception was thrown", "EXCEPTION"); WriteToLog.Log(e.Exception.Message, "EXCEPTION"); WriteToLog.Log(e.ToString(), "EXCEPTION"); }
public static void Log(string line, string type = "LOG") { WriteToLog.Log(line, type); }