public static void Write(string source, Exception ex) { if (_debug != null) { lock (_lockObj) { _debug.Write(DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss") + "\t" + source + "\t" + ex.Message + "\r\nStack Trace: \r\n\t" + ex.StackTrace + "\r\n\r\n"); } } }
public async void Execute() { try { await Run(); } catch (Exception exception) { debug.Write("Error at Execute: " + exception.ToString()); gui.SetState(LauncherState.Error); gui.AddUserMessage("Wurm Assistant Launcher has encountered an error: " + exception.ToStringMessagesOnly(), Color.Red); gui.ShowGui(); } }
public void AddUserMessage(string message, Color?textColor = null) { ThreadSafeInvoke(() => { debug.Write(message + Environment.NewLine); var newString = DateTime.Now + " > " + message + Environment.NewLine; messages.Add(new OutputMessage() { Content = newString, Color = textColor }); RebuildOutput(); }); }
public static void Write(string source, string message) { if (_debug != null) { Monitor.Enter(_lockObj); try { _debug.Write("[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "] [" + source + "] " + message + "\r\n"); } catch { } finally { Monitor.Exit(_lockObj); } } }