您的位置:首页 > 其它

自己写的一个日志记录类

2005-11-10 12:31 337 查看
using System;
using System.IO;
using System.Net;

namespace Utils
class Test
{
private Utils.LogWritter m_logger = null;
public Test()
{
m_logger = Utils.LogWritter.CreateInstance();
m_logger.SetFilePath(@"C:\TestLog.txt");
}

static void Main()
{
try
{
string str = "a";
str.Substring(0, 2);
}
catch(Exception ee)
{
m_logger.WriteLog(ee.ToString());
}
}
}

今天在csdn上面看到有人找记录错误日志的类,可以记录机器名,时间..
正好有空,就胡乱写了一个.但是有一点还是不太清楚,日志类的记录方法到底静态的好呢?还是普通的好呢?欢迎朋友多提宝贵意见和看法.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐