c# log

		public static void WritetLog(string strMessage)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory;
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            string fileFullPath = path + DateTime.Now.ToString("yyyy-MM-dd") + ".openIdNotMember.txt";
            StringBuilder str = new StringBuilder();
            str.Append(strMessage);
            StreamWriter sw;
            if (!File.Exists(fileFullPath))
            {
                sw = File.CreateText(fileFullPath);
            }
            else
            {
                sw = File.AppendText(fileFullPath);
            }

            sw.WriteLine(str.ToString());
            sw.Close();
        }

  

posted @ 2019-08-14 14:38  Schauspieler  阅读(118)  评论(0编辑  收藏  举报