-
Notifications
You must be signed in to change notification settings - Fork 0
/
ErrorLogging.cs
28 lines (27 loc) · 1 KB
/
ErrorLogging.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.IO;
namespace EdsACPlugin
{
internal class ErrorLogging
{
internal static void LogError(string logFile, Exception ex)
{
using (StreamWriter sw = new StreamWriter(logFile, true))
{
sw.WriteLine("============================================================================");
sw.WriteLine(DateTime.Now.ToString());
sw.WriteLine("Error: " + ex.Message);
sw.WriteLine("Source: " + ex.Source);
sw.WriteLine("Stack: " + ex.StackTrace);
if (ex.InnerException != null)
{
sw.WriteLine("Inner: " + ex.InnerException.Message);
sw.WriteLine("Inner Stack: " + ex.InnerException.StackTrace);
}
sw.WriteLine("============================================================================");
sw.WriteLine("");
sw.Close();
}
}
}
}