diff --git a/cli/ExceptionLogger.cs b/cli/ExceptionLogger.cs index 1e76193..de9b543 100644 --- a/cli/ExceptionLogger.cs +++ b/cli/ExceptionLogger.cs @@ -7,6 +7,10 @@ public static class ExceptionLogger { public static void Log(Exception ex) { +#if DEBUG + Console.WriteLine("Unexpected exception caught:"); + Console.WriteLine(ex); +#else var logDirectoryPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "elk/logs" @@ -17,5 +21,6 @@ public static void Log(Exception ex) var logFilePath = Path.Combine(logDirectoryPath, $"exception-{date}.txt"); File.WriteAllText(logFilePath, ex.ToString()); Console.WriteLine($"Unexpected exception caught! This is a bug. Log written to: {logFilePath}"); +#endif } } \ No newline at end of file diff --git a/cli/Program.cs b/cli/Program.cs index 95aa7aa..88906c4 100644 --- a/cli/Program.cs +++ b/cli/Program.cs @@ -107,10 +107,10 @@ catch (Exception ex) { ExceptionLogger.Log(ex); + Console.WriteLine("Press any key to continue"); + Console.ReadKey(); } } - - return; } var session = new ShellSession(