标签:rgb direct bsp 日志 time 记录 odi exists stream
public static void LogToFile(string LogFilePath, string LogFileName, string doWhat, string msg) { string stmp = "时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"\r\n"; if (!string.IsNullOrEmpty(doWhat)) stmp += "操作:" + doWhat + "\r\n"; if (!string.IsNullOrEmpty(msg)) stmp += "说明:" + msg + "\r\n\r\n"; string path = Path.Combine(LogFilePath, LogFileName); string dir=Path.GetDirectoryName(path); if (!System.IO.Directory.Exists(dir)) { Directory.CreateDirectory(dir); } FileStream fs = new FileStream(path, FileMode.Append); byte [] buff=System.Text.Encoding.Default.GetBytes(stmp); fs.Write(buff, 0, buff.Length); fs.Close(); }
标签:rgb direct bsp 日志 time 记录 odi exists stream
原文地址:https://www.cnblogs.com/Zingu/p/14637924.html