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.
37 lines
910 B
37 lines
910 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Configuration;
|
|
|
|
namespace AirbagSupportPackageService
|
|
{
|
|
public static class WriteLog
|
|
{
|
|
public static void Write(string info)
|
|
{
|
|
string filePath = ConfigurationManager.AppSettings["logFilePath"];
|
|
|
|
if (string.IsNullOrEmpty(filePath))
|
|
{
|
|
filePath = System.AppDomain.CurrentDomain.BaseDirectory;
|
|
}
|
|
|
|
string fileName = filePath + string.Format(@"\LogFile\logtxt{0}.txt", System.DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
|
if (File.Exists(fileName) == false)
|
|
{
|
|
File.Create(fileName).Close();
|
|
}
|
|
|
|
StreamWriter sw = File.AppendText(fileName);
|
|
sw.WriteLine(info);
|
|
|
|
sw.Flush();
|
|
|
|
sw.Close();
|
|
|
|
}
|
|
}
|
|
}
|
|
|