Skip to content

Commit

Permalink
일단 크래시 리포터 호출부분만 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheric0210 committed Dec 14, 2023
1 parent 344fe89 commit 68632e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion AutoKkutuGui/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Globalization;
using System.IO;
using System.Windows;
using Serilog;
using Serilog.Sinks.SystemConsole.Themes;
Expand Down Expand Up @@ -44,7 +46,8 @@ public App()

private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Log.Fatal((Exception)e.ExceptionObject, "Program crashed! Report this to the developer.");
Log.Fatal((Exception)e.ExceptionObject, "Unhandled exception!");
new CrashReportWriter("CrashReport_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss_fff", CultureInfo.InvariantCulture)).Write();
MessageBox.Show(e.ExceptionObject?.ToString(), "Unhandled Exception!", MessageBoxButton.OK, MessageBoxImage.Error);
Log.CloseAndFlush(); // Ensure all logs to be logged
}
Expand Down
11 changes: 11 additions & 0 deletions AutoKkutuGui/CrashReportWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace AutoKkutuGui;
internal class CrashReportWriter
{
private readonly string file;
public CrashReportWriter(string file) => this.file = file;

public void Write()
{
// todo
}
}

0 comments on commit 68632e5

Please sign in to comment.