天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
827 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Configuration;
namespace OpcProcessWinService
{
public static class WriteLog
{
public static void Write(string info)
{
string filePath = ConfigurationManager.AppSettings["logFilePath"];
if (string.IsNullOrEmpty(filePath))
{
filePath = System.AppDomain.CurrentDomain.BaseDirectory;
}
if (File.Exists(filePath + @"\logtxt.txt") == false)
{
File.Create(filePath + @"\logtxt.txt").Close();
}
StreamWriter sw = File.AppendText(filePath + @"\logtxt.txt");
sw.WriteLine(info);
sw.Flush();
sw.Close();
}
}
}