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.
 
 

58 lines
1.6 KiB

namespace com.hitrust.trustpay.client
{
using System;
using System.IO;
using System.Text;
public class LogWriter
{
internal StringBuilder iLogBuffer = new StringBuilder();
public virtual void closeWriter(Stream aLogFile)
{
try
{
if (aLogFile != null)
{
StreamWriter tLogFile = new StreamWriter(aLogFile, Encoding.GetEncoding("gb2312")) {
AutoFlush = true
};
tLogFile.Write(this.iLogBuffer.ToString());
tLogFile.Close();
}
}
catch (Exception)
{
}
}
public virtual void log(string aLogString)
{
try
{
aLogString = aLogString.Replace("\r", "");
aLogString = aLogString.Replace("\n", "\n ");
this.iLogBuffer.Append(aLogString);
}
catch (Exception)
{
}
}
public virtual void logNewLine(string aLogString)
{
string tLogTime = new HiCalendar().toString("%Y/%m/%d-%H:%M:%S ");
try
{
this.iLogBuffer.Append("\n" + tLogTime);
aLogString = aLogString.Replace("\r", "");
aLogString = aLogString.Replace("\n", "\n ");
this.iLogBuffer.Append(aLogString);
}
catch (Exception)
{
}
}
}
}