zoukankan      html  css  js  c++  java
  • 写日志

            public void Log(string message)
            {
                try
                {
                    string LogPath = @"C:CRMLog";
                    if (!Directory.Exists(LogPath))
                    {
                        Directory.CreateDirectory(LogPath);
                    }
                    string filePath = LogPath + DateTime.Now.ToString("yyyy-MM-dd") + "_delete.log";
                    using (FileStream stream = File.Open(filePath, FileMode.Append, FileAccess.Write, FileShare.Write))
                    {
                        using (StreamWriter sw = new StreamWriter(stream))
                        {
                            sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                            sw.WriteLine(message);
                            sw.Flush();
                        }
                    }
                }
                catch
                { }
            }
  • 相关阅读:
    随机数
    质数
    猜数
    失败
    判断质数
    2019.7.21记录
    9*9乘法表
    小人
    奔跑的字母

  • 原文地址:https://www.cnblogs.com/jiangchengbiao/p/10207615.html
Copyright © 2011-2022 走看看