Exemplo n.º 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.");
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
 public void LogMessage(int level, string msg)
 {
     if (this.level <= level)
     {
         Write(msg);
     }
     if (NextLogger != null)
     {
         NextLogger.LogMessage(level, msg);
     }
 }