Exemplo n.º 1
0
        void ILogger.WriteLog(Common.LogType LogType, string Log)
        {
            if (webAPILogType.Contains(LogType.ToString()))
            {
                // write into file
                if (!Directory.Exists(logFilePath))
                {
                    Directory.CreateDirectory(logFilePath);
                }

                //using (System.IO.StreamWriter loggerFile = new System.IO.StreamWriter(logFilePath + "\\LogFile_" + Guid.NewGuid().ToString() + ".txt", true))
                //{
                //    loggerFile.WriteLine("[" + DateTime.Now.ToString() + "]" + LogType.ToString() + ":" + "<" + Log + ">");
                //}
                System.IO.File.WriteAllText(logFilePath + "\\LogFile_" + Guid.NewGuid().ToString() + ".txt", "[" + DateTime.Now.ToString() + "]" + LogType.ToString() + ":" + "<" + Log + ">");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// This method logs the file and sends the notification
 /// </summary>
 /// <param name="logType">Specifies the type of log(e.g. Error, Success, Application Error)</param>
 /// <param name="errorMsg">Specifies the error message to be logged</param>
 /// <param name="sendNotification">Sets whether to send notification mail or not (Optional Parameter)</param>
 /// <param name="emailId">Contains the recipient email id (Optional Parameter)</param>
 public static void FileLog(Common.LogType logType, string errorMsg, bool sendNotification = false, string emailId = "")
 {
     //Implementation pending
 }//FileLog