//================================================================================================================================================================================================= /// <summary> /// Writes an error message /// </summary> /// <param name="who">Who writes the message</param> /// <param name="message">A message</param> /// <param name="isSilent">TRUE - тихий режим</param> public static void WriteError(ELogsWhat who, string message, bool isSilent) { string mess = string.Format("[ ELogsType:{0}; ELogsWhat:{1}; Message:{2}; DateTime:{3} ]", ELogsType.Error.ToString(), who.ToString(), message, DateTime.Now.ToString()); WriteLogTxt(mess); if (!isSilent) { System.Windows.Forms.MessageBox.Show(mess, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
//================================================================================================================================================================================================= /// <summary> /// Writes an error message from Exception /// </summary> /// <param name="who">Who writes the message</param> /// <param name="ex">Exception</param> /// <param name="isSilent">Тихий режим</param> public static void WriteError(ELogsWhat who, Exception ex, bool isSilent) { string mess = string.Format("[ ELogsType:{0}; ELogsWhat:{1}; {2} Source:{3}; TargetSite:{4}; StackTrace:{5}; DateTime:{6} ]", ELogsType.Error.ToString(), who.ToString(), ex.Message, ex.Source, ex.TargetSite, ex.StackTrace, DateTime.Now.ToString()); WriteLogTxt(mess); if (!isSilent) { System.Windows.Forms.MessageBox.Show(mess, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
//================================================================================================================================================================================================= /// <summary> /// Writes a warning message /// </summary> /// <param name="who">Who writes the message</param> /// <param name="message">A message</param> public static void WriteWarning(ELogsWhat who, string message) { string mess = string.Format("[ ELogsType:{0}; ELogsWhat:{1}; Message:{2}; DateTime:{3} ]", ELogsType.Warning.ToString(), who.ToString(), message, DateTime.Now.ToString()); WriteLogTxt(mess); }
//================================================================================================================================================================================================= /// <summary> /// Writes an info message /// </summary> /// <param name="who">Who writes the message</param> /// <param name="message">A message</param> /// <param name="isSilent">TRUE - Тихий режим</param> public static void WriteInfo(ELogsWhat who, string message, string User, string TableName, bool isSilent) { string mess = string.Format("[ ELogsType:{0}; ELogsWhat:{1}; Message:{2}; DateTime:{3} ]", ELogsType.Info.ToString(), who.ToString(), message, DateTime.Now.ToString()); ConnectDB cn = new ConnectDB(); cn.WriteLogICSMBase(who, message, User, TableName); WriteLogTxt(mess); if (!isSilent) { System.Windows.Forms.MessageBox.Show(mess, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } }
//================================================================================================================================================================================================= /// <summary> /// Writes an error message /// </summary> /// <param name="who">Who writes the message</param> /// <param name="message">A message</param> /// <param name="isSilent">TRUE - тихий режим</param> public static void WriteError(ELogsWhat who, string message, bool isSilent) { string mess = string.Format("[ ELogsType:{0}; ELogsWhat:{1}; Message:{2}; DateTime:{3} ]", ELogsType.Error.ToString(), who.ToString(), message, DateTime.Now.ToString()); WriteLogTxt(mess); }