sharp-tradebot/logging/FileLogger.cs

27 lines
444 B
C#

using System;
using System.IO;
namespace sharp.trading.logging
{
public class FileLogger : Logger
{
TextWriter writer;
public FileLogger(string filename)
{
this.writer = new StreamWriter(new FileStream(filename, FileMode.Append));
}
protected override void log(string line)
{
this.writer.WriteLine(line);
this.writer.Flush();
}
public override void Close()
{
this.writer.Close();
base.Close();
}
}
}