public static void WriteToLog(string EventName, string Action)
{
string appName = Environment.CurrentDirectory;
int l = appName.Length;
int h = appName.LastIndexOf("bin");
string ll = appName.Remove(h);
string strPath = ll + "FolderLog";
if (!Directory.Exists(strPath))
{
Directory.CreateDirectory(strPath);
}
string fileLoc = strPath + "\\" + DateTime.Now.ToString("ddMMMyyyy") + ".log";
FileStream Fs = new FileStream(fileLoc, FileMode.Append);
BinaryWriter BWriter = new BinaryWriter(Fs, Encoding.GetEncoding("UTF-8"));
string msg = string.Format("\r\n" + DateTime.Now.ToString() + " ==> EventName:: " + EventName + " ==> Action:: " + Action);
BWriter.Write(msg.ToString());
Fs.Close();
}
{
string appName = Environment.CurrentDirectory;
int l = appName.Length;
int h = appName.LastIndexOf("bin");
string ll = appName.Remove(h);
string strPath = ll + "FolderLog";
if (!Directory.Exists(strPath))
{
Directory.CreateDirectory(strPath);
}
string fileLoc = strPath + "\\" + DateTime.Now.ToString("ddMMMyyyy") + ".log";
FileStream Fs = new FileStream(fileLoc, FileMode.Append);
BinaryWriter BWriter = new BinaryWriter(Fs, Encoding.GetEncoding("UTF-8"));
string msg = string.Format("\r\n" + DateTime.Now.ToString() + " ==> EventName:: " + EventName + " ==> Action:: " + Action);
BWriter.Write(msg.ToString());
Fs.Close();
}