示例#1
0
        static void Main()
        {
            AbstractLogger loggerChain = getChainOfLoggers();

            loggerChain.LogMessage(AbstractLogger.INFO, "This is an information.");
            loggerChain.LogMessage(AbstractLogger.DEBUG, "This is an debug level information.");
            loggerChain.LogMessage(AbstractLogger.ERROR, "This is an error information.");
        }
示例#2
0
        public static void Demo()
        {
            AbstractLogger lc = GetChainOfLoggers();

            lc.LogMessage(AbstractLogger.INFO, "This is an information");
            lc.LogMessage(AbstractLogger.DEBUG, "This is an debug information");
            lc.LogMessage(AbstractLogger.ERROR, "This is an error information");

            Console.ReadLine();
        }
示例#3
0
 public void LogMessage(int level, string msg)
 {
     if (this.level <= level)
     {
         Write(msg);
     }
     if (NextLogger != null)
     {
         NextLogger.LogMessage(level, msg);
     }
 }