Exemple #1
0
 /// <summary>
 /// 记录日志2
 /// </summary>
 /// <param name="message"></param>
 public static void Write_log(string filename, string message)
 {
     try
     {
         Helper_Txt.AppendAllText(Get_FullPath(filename), string.Format(msg_format, DateTime.Now.ToLocalTime(), "INFO", message));
     }
     catch (Exception ex)
     {
         Write_Error(ex.Message);
     }
 }
Exemple #2
0
        public static void Write_Error(string folder, string filename, string message)
        {
            string fullfilename = Path.Combine(folder, filename);

            try
            {
                Helper_Txt.AppendAllText(fullfilename, string.Format(msg_format, DateTime.Now.ToLocalTime(), "ERROR", message));
            }
            catch (Exception ex)
            {
                Write_Error(ex.Message);
            }
        }
Exemple #3
0
        public static void Write_log(string folder, string filename, string message, bool bTimeFormat = true)
        {
            string fullfilename = Path.Combine(folder, filename);

            try
            {
                if (bTimeFormat)
                {
                    Helper_Txt.AppendAllText(fullfilename, string.Format(msg_format, DateTime.Now.ToLocalTime(), "INFO", message));
                }
                else
                {
                    Helper_Txt.AppendAllText(fullfilename, message + Environment.NewLine);
                }
            }
            catch (Exception ex)
            {
                Write_Error(ex.Message);
            }
        }
Exemple #4
0
 public static void Write_Error(string message)
 {
     Helper_Txt.AppendAllText(Get_FullPath(string.Empty), string.Format(msg_format, DateTime.Now.ToLocalTime(), "ERROR", message));
 }