/// <summary>
/// Append a line to the log 在日志文件中添加一行
/// </summary>
/// <param name="pLogMess">The message to log</param>
/// <param name="messLevel">The importance level of the message</param>
public void AppendString(String pLogMess, LogLevel messLevel)
{
// Generate localized date for the log event
DateTime date = DateTime.Now;
String logEntry = String.Format("[{0}][{1}] {2}", date.ToString("G", CultureManager.Instance().GetCultureInfo()), messLevel, pLogMess);
//TMP for debug purpose only
if (this.printToConsole)
{
Console.WriteLine(logEntry);
}
// Write to the log if the message level is superior or equal to the log level
if((int)messLevel >= (int) this.LogLevel)
{
using (StreamWriter sw = File.AppendText(this.logFile.FullName))
{
sw.WriteLine(logEntry);
sw.Flush();
}
}
}