using System;
using System.Collections;
using System.Text;
using System.IO;

namespace LoggingSample
{
    class FileLogger: ILogger
    {
        private string mFileName;
        private StreamWriter mLogFile;

        public string FileName
        {
            get { return mFileName; }
        }

        public FileLogger(string fileName)
        {
            mFileName = fileName;
        }

        public void Init()
        {
            mLogFile = new StreamWriter(mFileName);
        }

        public void Terminate()
        {
            mLogFile.Close();
        }

        public void ProcessLogMessage(string logMessage)
        {
            // FileLogger implements the ProcessLogMessage method by writing the incoming
            // message to a file.
            mLogFile.WriteLine(logMessage);
        }
    }
}