31 lines
647 B
C#
31 lines
647 B
C#
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Diagnostics;
|
|
|
|
namespace sharp.trading.logging
|
|
{
|
|
public abstract class Logger : MarshalByRefObject
|
|
{
|
|
|
|
protected abstract void log(string line);
|
|
|
|
public void Log(string format, params object[] args)
|
|
{
|
|
string preformat = string.Format(format, args);
|
|
string postformat = string.Format("{0} {1} {2}", DateTime.Now.ToLocalTime(), Process.GetCurrentProcess().Id, preformat);
|
|
lock (this)
|
|
{
|
|
log(postformat);
|
|
}
|
|
}
|
|
|
|
public void Log(Exception e){
|
|
Log("An Exception occured: {0} in {1}", e.ToString(),e.StackTrace);
|
|
}
|
|
|
|
public virtual void Close(){
|
|
}
|
|
}
|
|
}
|