static MyLogger() { switch (ConfigurationManager.AppSettings["LoggerType"]) { case "FileLogger": logger = new FileLogger(); break; case "DBLogger": logger = new DBLogger(); break; case "JsonLogger": logger = new JsonLogger(); break; default: throw new Exception("logger 가 null 입니다."); } }
public static void Log(LogTarget target, string message) { switch (target) { case LogTarget.File: logger = new FileLogger("Logger.txt"); logger.Log(message); break; case LogTarget.Console: logger = new ConsoleLogger(); logger.Log(message); break; case LogTarget.EventLog: logger = new EventLogger(); logger.Log(message); break; default: return; } }
public static void Log(LogTarget target, string message, Level level) { switch (target) { case LogTarget.File: logger = new FileLogger(@"C:\Users\accountant.AHM\Desktop\testsig\pdfin"); logger.Log(message, level); break; case LogTarget.Database: logger = new DBLogger(); logger.Log(message, level); break; case LogTarget.EventLog: logger = new EventLogger(); logger.Log(message, level); break; default: return; } }