36 lines
820 B
36 lines
820 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Configuration;
|
|
|
|
namespace WriteLogSpace
|
|
{
|
|
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();
|
|
|
|
}
|
|
}
|
|
}
|
|
|