using System;
using System.Data;
using System.IO;
using System.Text;
namespace MASReport
{
/// <summary>
/// LogUtil 的摘要说明。
/// </summary>
public class LogUtil
{
public LogUtil()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 保存字符串
/// </summary>
/// <param name="strCSV">csv字符串</param>
/// <returns></returns>
public static bool SaveLog(string strLog)
{
try
{
//保存文件的完全路径
string strsavepath=System.Environment.CurrentDirectory+"/"+FileName;
if(File.Exists(strsavepath)==false)
{
File.Create(strsavepath);
}
StreamWriter streamWriter = new StreamWriter(strsavepath,true,System.Text.Encoding.Default);
streamWriter.WriteLine("");
streamWriter.WriteLine(strLog);
streamWriter.Close();
return true;
}
catch
{
return false;
}
}
private static string FileName
{
get
{
return "log.txt";
}
}
}
}
using System.Data;
using System.IO;
using System.Text;
namespace MASReport
{
/// <summary>
/// LogUtil 的摘要说明。
/// </summary>
public class LogUtil
{
public LogUtil()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 保存字符串
/// </summary>
/// <param name="strCSV">csv字符串</param>
/// <returns></returns>
public static bool SaveLog(string strLog)
{
try
{
//保存文件的完全路径
string strsavepath=System.Environment.CurrentDirectory+"/"+FileName;
if(File.Exists(strsavepath)==false)
{
File.Create(strsavepath);
}
StreamWriter streamWriter = new StreamWriter(strsavepath,true,System.Text.Encoding.Default);
streamWriter.WriteLine("");
streamWriter.WriteLine(strLog);
streamWriter.Close();
return true;
}
catch
{
return false;
}
}
private static string FileName
{
get
{
return "log.txt";
}
}
}
}
浙公网安备 33010602011771号