public IError CreateError(string dateTimeToString, string errorLevelToString, string message) { ErrorLevelParser errorLevelParser = new ErrorLevelParser(); DateTime dateTime = DateTime.ParseExact(dateTimeToString, DateFormat, CultureInfo.InvariantCulture); ErrorLevel errorLevel = errorLevelParser.ParseErrorLevel(errorLevelToString); IError error = new Error(dateTime, errorLevel, message); return(error); }
public IAppender CreateAppender(string appenderType, string errorToString, string layoutType) { ErrorLevelParser errorLevelParser = new ErrorLevelParser(); ILayout layout = this.layoutFactory.CreateLayout(layoutType); ErrorLevel errorLevel = errorLevelParser.ParseErrorLevel(errorToString); IAppender appender = null; switch (appenderType) { case "ConsoleAppender": appender = new ConsoleAppender(layout, errorLevel); break; case "FileAppender": ILogFile logFile = new LogFile(string.Format(DefaultFileName, this.fileNumber)); appender = new FileAppender(layout, errorLevel, logFile); break; default: throw new ArgumentException("Invalid Appender Type!"); } return(appender); }