Example #1
0
        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;
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }