Esempio n. 1
0
        public void Logger_GetLogger_ChangesCategory()
        {
            var     target = GetLogMemoryTarget();
            ILogger log    = new NLogLogger(LogManager.GetLogger("category1"));

            log.Info("msg");
            Assert.Equal("category1|Info|msg||", target.Logs.Last());

            log = log.GetLogger("cat2");
            log.Info("msg");
            Assert.Equal("cat2|Info|msg||", target.Logs.Last());

            log = log.GetLogger(GetType());
            log.Info("msg");
            Assert.Equal($"{GetType().FullName}|Info|msg||", target.Logs.Last());
        }