public void CachesLoggers()
        {
            SeverityFilter severityFilter    = new SeverityFilter(null, TraceEventType.Critical | TraceEventType.Error);
            TestEntLibLoggerFactoryAdapter a = CreateTestEntLibLoggerFactoryAdapter(severityFilter);

            ILog log = a.GetLogger(this.GetType());

            Assert.AreSame(log, a.GetLogger(this.GetType()));
        }
        public void LogsMessage()
        {
            SeverityFilter severityFilter    = new SeverityFilter(null, TraceEventType.Critical | TraceEventType.Error);
            TestEntLibLoggerFactoryAdapter a = CreateTestEntLibLoggerFactoryAdapter(severityFilter);
            Exception ex = new Exception("errormessage");

            ILog log = a.GetLogger(this.GetType());

            // not logged due to severity filter
            a.LastLogEntry = null;
            log.Trace("Message1", ex);
            Assert.IsNull(a.LastLogEntry);

            // logged, passes severity filter
            a.LastLogEntry = null;
            log.Error("Message2", ex);
            Assert.AreEqual(TraceEventType.Error, a.LastLogEntry.Severity);
            Assert.AreEqual("Message2", a.LastLogEntry.Message);
            Assert.AreEqual(a.DefaultPriority, a.LastLogEntry.Priority);
            Assert.AreEqual(1, a.LastLogEntry.Categories.Count);
            Assert.AreEqual(this.GetType().FullName, a.LastLogEntry.CategoriesStrings[0]);
            Assert.AreEqual("Exception[ message = errormessage, source = , targetsite = , stacktrace =  ]", a.LastLogEntry.ErrorMessages.Trim());
        }
 public TestEntLibLogger(TestEntLibLoggerFactoryAdapter owner, string category, LogWriter logWriter, EntLibLoggerSettings settings)
     : base(category, logWriter, settings)
 {
     this.owner = owner;
 }
 public TestEntLibLogger(TestEntLibLoggerFactoryAdapter owner, string category, LogWriter logWriter, EntLibLoggerSettings settings)
     : base(category, logWriter, settings)
 {
     this.owner = owner;
 }