Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Inititialize()

static void Terraria.Utilities.CrashWatcher.Inititialize ( )
inlinestatic

Definition at line 22 of file CrashWatcher.cs.

23 {
24 Console.WriteLine("Error Logging Enabled.");
25 AppDomain.CurrentDomain.FirstChanceException += delegate(object sender, FirstChanceExceptionEventArgs exceptionArgs)
26 {
27 if (LogAllExceptions && 0 == 0)
28 {
29 string text2 = PrintException(exceptionArgs.Exception);
30 Console.Write(string.Concat("================\r\n" + $"{DateTime.Now}: First-Chance Exception\r\nThread: {Thread.CurrentThread.ManagedThreadId} [{Thread.CurrentThread.Name}]\r\nCulture: {Thread.CurrentThread.CurrentCulture.Name}\r\nException: {text2}\r\n", "================\r\n\r\n"));
31 }
32 };
33 AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs exceptionArgs)
34 {
35 string text = PrintException((Exception)exceptionArgs.ExceptionObject);
36 Console.Write(string.Concat("================\r\n" + $"{DateTime.Now}: Unhandled Exception\r\nThread: {Thread.CurrentThread.ManagedThreadId} [{Thread.CurrentThread.Name}]\r\nCulture: {Thread.CurrentThread.CurrentCulture.Name}\r\nException: {text}\r\n", "================\r\n"));
37 if (DumpOnCrash)
38 {
39 CrashDump.WriteException(CrashDumpOptions, DumpPath);
40 }
41 };
42 }
static void Write(string format, object? arg0)
Definition Console.cs:850
static void WriteLine()
Definition Console.cs:733
static CrashDump.Options CrashDumpOptions
static string PrintException(Exception ex)

References Terraria.Utilities.CrashWatcher.CrashDumpOptions, Terraria.Utilities.CrashWatcher.DumpOnCrash, Terraria.Utilities.CrashWatcher.DumpPath, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs.Exception, System.UnhandledExceptionEventArgs.ExceptionObject, Terraria.Utilities.CrashWatcher.LogAllExceptions, Terraria.Utilities.CrashWatcher.PrintException(), System.text, System.Console.Write(), Terraria.Utilities.CrashDump.WriteException(), and System.Console.WriteLine().

Referenced by Terraria.Program.SetupLogging().