示例#1
0
 public void extension_throws_for_FATAL()
 {
     Assert.Throws(typeof(VigilantException), new TestDelegate(() =>
     {
         logger.Fatal("");
     }
                                                               ));
 }
        public virtual void TestLoggingLevels()
        {
            IList    methodsCalled = SetRootInterceptor();
            ILogging logger        = Logger.Get(typeof(LoggingTestCase.ITestLogger));

            ((LoggingTestCase.ITestLogger)logger.Trace()).Msg();
            ((LoggingTestCase.ITestLogger)logger.Debug()).Msg();
            ((LoggingTestCase.ITestLogger)logger.Info()).Msg();
            ((LoggingTestCase.ITestLogger)logger.Warn()).Msg();
            ((LoggingTestCase.ITestLogger)logger.Error()).Msg();
            ((LoggingTestCase.ITestLogger)logger.Fatal()).Msg();
            Assert.AreEqual(Pair.Of(Logger.Trace, "msg"), ((Pair)PopFirst(methodsCalled)));
            Assert.AreEqual(Pair.Of(Logger.Debug, "msg"), ((Pair)PopFirst(methodsCalled)));
            Assert.AreEqual(Pair.Of(Logger.Info, "msg"), ((Pair)PopFirst(methodsCalled)));
            Assert.AreEqual(Pair.Of(Logger.Warn, "msg"), ((Pair)PopFirst(methodsCalled)));
            Assert.AreEqual(Pair.Of(Logger.Error, "msg"), ((Pair)PopFirst(methodsCalled)));
            Assert.AreEqual(Pair.Of(Logger.Fatal, "msg"), ((Pair)PopFirst(methodsCalled)));
        }
        public string ConsultarArticulo(string titulo)
        {
            try
            {
                _logging.Info($"Consultar artículo {titulo}");

                string contenido = _cache.Get(titulo);
                if (!string.IsNullOrWhiteSpace(contenido))
                {
                    _logging.Info($"Artículo encontrado en la cache {titulo}");
                    return(contenido);
                }

                _logging.Info($"buscar articulo en el sistema de archivos {titulo}");
            }
            catch (Exception e)
            {
                _logging.Fatal("Error", e);
            }
            return(_almacenamiento.LeerFichero(titulo));
        }
示例#4
0
 public void extension_throws_for_FATAL()
 {
     logger.Fatal("");
 }