Business.DatabaseHandler.LogException C# (CSharp) Метод

LogException() публичный Метод

Writes exception details into a log file.
public LogException ( Exception ex ) : void
ex System.Exception The exception to log.
Результат void
        public void LogException(Exception ex) {
            File.WriteAllText(Settings.UnhandledExceptionLogPath, ex.ToString());
            Process.Start("notepad.exe", Settings.UnhandledExceptionLogPath);
        }
    }

Usage Example

 private void HandleFatalException(Exception e) {
     string ErrorMessage = "An unhandled exception has occured. Do you want to see the error details? You may send this report by email to [email protected]";
     ErrorMessage += Environment.NewLine + Environment.NewLine + e.Message;
     if (MessageBox.Show(ErrorMessage, "Unhandled Exception", MessageBoxButton.YesNo) == MessageBoxResult.Yes) {
         DatabaseHandler Handler = new DatabaseHandler();
         Handler.LogException(e);
     }
 }