File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -83,8 +83,12 @@ public static void LogException(Exception ex)
8383 if ( ex == null )
8484 return ;
8585
86+ var crashDir = Path . Combine ( Native . OS . DataDir , "crashes" ) ;
87+ if ( ! Directory . Exists ( crashDir ) )
88+ Directory . CreateDirectory ( crashDir ) ;
89+
8690 var time = DateTime . Now . ToString ( "yyyy-MM-dd_HH-mm-ss" ) ;
87- var file = Path . Combine ( Native . OS . DataDir , $ "crash_ { time } .log") ;
91+ var file = Path . Combine ( crashDir , $ "{ time } .log") ;
8892 using var writer = new StreamWriter ( file ) ;
8993 writer . WriteLine ( $ "Crash::: { ex . GetType ( ) . FullName } : { ex . Message } ") ;
9094 writer . WriteLine ( ) ;
@@ -94,7 +98,6 @@ public static void LogException(Exception ex)
9498 writer . WriteLine ( $ "Framework: { AppDomain . CurrentDomain . SetupInformation . TargetFrameworkName } ") ;
9599 writer . WriteLine ( $ "Source: { ex . Source } ") ;
96100 writer . WriteLine ( $ "Thread Name: { Thread . CurrentThread . Name ?? "Unnamed" } ") ;
97- writer . WriteLine ( $ "User: { Environment . UserName } ") ;
98101 writer . WriteLine ( $ "App Start Time: { Process . GetCurrentProcess ( ) . StartTime } ") ;
99102 writer . WriteLine ( $ "Exception Time: { DateTime . Now } ") ;
100103 writer . WriteLine ( $ "Memory Usage: { Process . GetCurrentProcess ( ) . PrivateMemorySize64 / 1024 / 1024 } MB") ;
You can’t perform that action at this time.
0 commit comments