/// <summary> /// ��¼��־�ķ���,�÷���Ĭ�ϰ���־��Ϣ��¼���ı��ļ��� /// </summary> /// <param name="logMsg">��־�ı���Ϣ</param> /// <param name="logLevel">��־�ȼ�</param> public void Write(string logMsg, LogLevel logLevel) { MetaLog metaLog = new TxtMetaLog(logMsg); metaLog.Level = logLevel; this.Write(metaLog); }
/// <summary> /// 记录日志的方法,该方法默认把日志信息记录到文本文件。 /// </summary> /// <param name="logMsg">日志文本信息</param> /// <param name="logLevel">日志等级</param> public void Write(string logMsg, LogLevel logLevel) { MetaLog metaLog = new TxtMetaLog(logMsg); metaLog.Level = logLevel; this.Write(metaLog); }
/// <summary> /// 把日志信息输出到Txt类型文本文件的方法。 /// </summary> /// <param name="metaLog">日志数据封送对象</param> public virtual void Append(MetaLog metaLog) { TxtMetaLog txtlog = metaLog as TxtMetaLog; string filePath = Path.Combine(txtlog.Path, "log"); //如果目录不存在,则创建目录 if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } //完整格式的文件路径 string fullFileName = string.Format("{0}\\{1}.log", filePath, txtlog.LogDateTime.ToString("yyyyMMdd")); //写文件 StreamWriter sw = new StreamWriter(fullFileName, true, Encoding.GetEncoding(metaLog.Encoding)); sw.WriteLine(this.Format(metaLog)); sw.Close(); }
/// <summary> /// ��¼��־�ķ���,�÷���Ĭ�ϰ���־��Ϣ��¼���ı��ļ��� /// </summary> /// <param name="logMsg">��־�ı���Ϣ</param> public void Write(string logMsg) { MetaLog metaLog = new TxtMetaLog(logMsg); this.Write(metaLog); }
/// <summary> /// 记录日志的方法,该方法默认把日志信息记录到文本文件。 /// </summary> /// <param name="logMsg">日志文本信息</param> public void Write(string logMsg) { MetaLog metaLog = new TxtMetaLog(logMsg); this.Write(metaLog); }