An adapter, who's loggers capture all log events and send them to AddEvent. Retrieve the list of log events from LoggerEvents.
For a list of all members of this type, see CapturingLoggerFactoryAdapter Members .
System.Object
CapturingLoggerFactoryAdapter
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
This logger factory is mainly for debugging and test purposes. // configure for capturing
CapturingLoggerFactoryAdapter adapter = new CapturingLoggerFactoryAdapter();
LogManager.Adapter = adapter;
// reset capture state
adapter.Clear();
// log something
ILog log = LogManager.GetCurrentClassLogger();
log.DebugFormat("Current Time:{0}", DateTime.Now);
// check logged data
Assert.AreEqual(1, adapter.LoggerEvents.Count);
Assert.AreEqual(LogLevel.Debug, adapter.LastEvent.Level);
Namespace: Common.Logging.Simple
Assembly: Common.Logging (in Common.Logging.dll)
CapturingLoggerFactoryAdapter Members | Common.Logging.Simple Namespace