public void SetUp() { _provider = new SlaProvider(); SlaDefinitionBuilder.For <Request>(r => r.Id) .AddSla <Response>(_sla, r => r.Id) .Configure(_provider); _appender = InjectInMemoryAppender(); }
private void InjectInMemoryAppender(Level loggingLevel) { var appender = new InMemoryAppender(); var hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.ResetConfiguration(); hierarchy.Root.AddAppender(appender); hierarchy.Root.Level = loggingLevel; appender.ActivateOptions(); hierarchy.Configured = true; }
private InMemoryAppender InjectInMemoryAppender() { var appender = new InMemoryAppender(); var hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.ResetConfiguration(); hierarchy.Root.AddAppender(appender); hierarchy.Root.Level = Level.All; appender.ActivateOptions(); hierarchy.Configured = true; return(appender); }
public LogServiceTest() { this.testAppender = new InMemoryAppender(); var appenders = new List <ILogAppender> { testAppender }; var config = new LogServiceConfig { LogTemplate = "[{{username}}] - {{message}}", Appenders = new[] { testAppender }, PropertyProviders = new[] { new UserNamePropertyProvider(() => "Joe Schmoe") } }; sut = new LogService(config); }