public void LogException() { TestApplicationInsightsLoggerFactoryAdapter a = CreateTestApplicationInsightsLoggerFactoryAdapter(); ILog log = a.GetLogger(this.GetType()); Exception ex = new Exception("errormessage3"); log.Error(null, ex); Assert.AreEqual(ex, a.LastLogEntry.Exception); Assert.AreEqual(LogLevel.Error, a.LastLogEntry.LogLevel); }
public void LogMessage() { TestApplicationInsightsLoggerFactoryAdapter a = CreateTestApplicationInsightsLoggerFactoryAdapter(); ILog log = a.GetLogger(this.GetType()); log.Info("Message2"); Assert.AreEqual("Message2", a.LastLogEntry.Message); Assert.IsNull(a.LastLogEntry.Exception); Assert.AreEqual(LogLevel.Info, a.LastLogEntry.LogLevel); }
public TestApplicationInsightsLogger(TestApplicationInsightsLoggerFactoryAdapter owner, string instrumentationKey, string logName, LogLevel logLevel, bool showlevel, bool showDateTime, bool showLogName, string dateTimeFormat) : base(instrumentationKey, logName, logLevel, showlevel, showDateTime, showLogName, dateTimeFormat) { this.owner = owner; }