public static void LogException(Exception ex, string format, params object[] args) { string message = string.Format(format, args); #if DEBUG Debug.WriteLine("EXC: " + ErrorDispatcher.GetErrorMessageForException(ex, true)); #endif if (LoggingConfiguration.LoggingEnabled) { LogEntry entry = new LogEntry(message, ex, Assembly.GetCallingAssembly().GetName().Name); instance.EnqueueLogEntry(entry); } }
public LogEntry(string message, Exception ex, string assemblyName) { if (message.Length > 0) { this.message = string.Format("{0}\r\n{1}", message, ErrorDispatcher.GetErrorMessageForException(ex, true)); } else { this.message = ErrorDispatcher.GetErrorMessageForException(ex, true); } // This is already an application non-recoverable error. severityLevel = SeverityLevels.Exception; // Stack dump. stackDump = ex.StackTrace; // Store the assemblyy name. this.assemblyName = assemblyName; GetAppName(); }
private void OnApplicationThreadException(object sender, ThreadExceptionEventArgs e) { ErrorDispatcher.DispatchError(e.Exception); }