초기커밋
This commit is contained in:
41
ServerCore/Dump/DumpHelper.cs
Normal file
41
ServerCore/Dump/DumpHelper.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ServerCore;
|
||||
|
||||
public static class DumpHelper
|
||||
{
|
||||
public static DumpConfig DumpConfig;
|
||||
|
||||
private static void unhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
// 윈도우 덤프 경로: C:\Users\xxxxxx\AppData\Local\CrashDumps
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
Exception ex = (Exception)e.ExceptionObject;
|
||||
MiniDump.write(DumpConfig, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void init(string dumpPath, string name)
|
||||
{
|
||||
DumpConfig.DumpFile = $"{dumpPath}\\{name}_{DateTime.Now.Ticks}.dmp";
|
||||
DumpConfig.TxtFile = $"{dumpPath}\\{name}_{DateTime.Now.Ticks}.txt";
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(DumpHelper.unhandledExceptionHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += DumpHandler.unhandledExceptionHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user