示例#1
0
        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 입니다.");
            }
        }
示例#2
0
        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;
            }
        }
示例#3
0
            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;
                }
            }