63 lines
2.2 KiB
C#
63 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Drawing.Printing;
|
|
using ZedGraph;
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
namespace GenesisDisplayTool
|
|
{
|
|
public static partial class ErrorLog
|
|
{
|
|
|
|
public static void Log(String reason, String description, String Parameter1, String Parameter2)
|
|
{
|
|
#region Definitions and initializations
|
|
// StringBuilder messageBoxCS = new StringBuilder();
|
|
String userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
|
String WriteToErrFile = $"{DateTime.Now.ToString(Formats.ErrorLogString)}{userName};{reason};{description};{Parameter1};{Parameter2}";
|
|
#endregion
|
|
#region Write settings to file
|
|
try
|
|
{
|
|
using (System.IO.StreamWriter sw0 = System.IO.File.AppendText(@"..\ErrorLog.txt"))
|
|
sw0.WriteLine(WriteToErrFile);
|
|
}
|
|
catch
|
|
{
|
|
// MessageBox.Show("Error parameters could not be written to file", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
public static void Write(string reason)
|
|
{
|
|
#region Definitions and initializations
|
|
// System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
|
|
String userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
|
String WriteToErrFile = $"{DateTime.Now.ToString("mm:ss:fff")}{reason}";
|
|
#endregion
|
|
#region Write settings to file
|
|
try
|
|
{
|
|
using (System.IO.StreamWriter sw0 = System.IO.File.AppendText(@"..\Write.txt"))
|
|
sw0.WriteLine(WriteToErrFile);
|
|
}
|
|
catch
|
|
{
|
|
// MessageBox.Show("Error parameters could not be written to file", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
|
|
}
|
|
} |