namespace OubHackMS.Logging.Handlers
{
    using OubHackMS.Core;
    using OubHackMS.Logging;
    using System;
    using System.IO;

    internal class LogFileError : LoggingHandler
    {
        public LogFileError(OubHackMS parent) : base(parent)
        {
            base.handleKey = Level.LOG_FILE_ERROR;
        }

        public override void onLog(params object[] oArgs)
        {
            if (oArgs.Length >= 1)
            {
                if (!Directory.Exists("logs"))
                {
                    Directory.CreateDirectory("logs");
                }
                File.AppendAllText("logs/errors.txt", DateTime.Now.ToString("[yyyy:MM:dd hh:mm:ss] ") + oArgs[0].ToString() + Environment.NewLine);
            }
        }
    }
}

