예제 #1
0
        public void CanHandleLogCategoryShading()
        {
            using (NewDocumentStore())
            {
                var target = LogManager.GetTarget <AdminLogsTarget>();
                Assert.NotNull(target);

                using (var client1Target = target.For("client1"))
                {
                    var fakeTransport1 = new FakeLogTransport();
                    client1Target.Reconnect(fakeTransport1);
                    var category1Log = LogManager.GetLogger("Raven.Category1");
                    var category1Sub = LogManager.GetLogger("Raven.Category1.Sub1");

                    client1Target.EnableLogging("Raven.Category1", LogLevel.Info);
                    client1Target.EnableLogging("Raven.Category1.Sub1", LogLevel.Debug);

                    category1Log.Debug("Debug1");
                    category1Log.Info("Info1");
                    category1Log.Error("Error1");

                    category1Sub.Debug("Debug2");
                    category1Sub.Info("Info2");
                    category1Sub.Error("Error2");


                    Assert.Equal(5, fakeTransport1.Messages.Count);
                    Assert.Equal("Info1", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Error1", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Debug2", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Info2", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Error2", fakeTransport1.Messages.Take().FormattedMessage);
                }
            }
        }
예제 #2
0
        public void CanAddNewClient()
        {
            using (NewDocumentStore())
            {
                var target = LogManager.GetTarget <AdminLogsTarget>();
                Assert.NotNull(target);

                using (var client1Target = target.For("client1"))
                {
                    var fakeTransport1 = new FakeLogTransport();
                    client1Target.Reconnect(fakeTransport1);
                    var category1Log = LogManager.GetLogger("Raven.Category1");

                    client1Target.EnableLogging("Raven.Category1", LogLevel.Info, false);

                    category1Log.Debug("Debug");
                    category1Log.Info("Info");
                    category1Log.Error("Error");

                    Assert.Equal(2, fakeTransport1.Messages.Count);
                    Assert.Equal("Info", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Error", fakeTransport1.Messages.Take().FormattedMessage);
                }
            }
        }
예제 #3
0
        public void CanHandleLogCategoryShading()
        {
            using (NewDocumentStore())
            {
                var target = LogManager.GetTarget<AdminLogsTarget>();
                Assert.NotNull(target);

                using (var client1Target = target.For("client1"))
                {
                    var fakeTransport1 = new FakeLogTransport();
                    client1Target.Reconnect(fakeTransport1);
                    var category1Log = LogManager.GetLogger("Raven.Category1");
                    var category1Sub = LogManager.GetLogger("Raven.Category1.Sub1");

                    client1Target.EnableLogging("Raven.Category1", LogLevel.Info);
                    client1Target.EnableLogging("Raven.Category1.Sub1", LogLevel.Debug);

                    category1Log.Debug("Debug1");
                    category1Log.Info("Info1");
                    category1Log.Error("Error1");

                    category1Sub.Debug("Debug2");
                    category1Sub.Info("Info2");
                    category1Sub.Error("Error2");


                    Assert.Equal(5, fakeTransport1.Messages.Count);
                    Assert.Equal("Info1", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Error1", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Debug2", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Info2", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Error2", fakeTransport1.Messages.Take().FormattedMessage);
                }
            }
        }
예제 #4
0
        public void CanAddNewClient()
        {
            using (NewDocumentStore())
            {
                var target = LogManager.GetTarget<AdminLogsTarget>();
                Assert.NotNull(target);

                using (var client1Target = target.For("client1"))
                {
                    var fakeTransport1 = new FakeLogTransport();
                    client1Target.Reconnect(fakeTransport1);
                    var category1Log = LogManager.GetLogger("Raven.Category1");

                    client1Target.EnableLogging("Raven.Category1", LogLevel.Info, false);

                    category1Log.Debug("Debug");
                    category1Log.Info("Info");
                    category1Log.Error("Error");

                    Assert.Equal(2, fakeTransport1.Messages.Count);
                    Assert.Equal("Info", fakeTransport1.Messages.Take().FormattedMessage);
                    Assert.Equal("Error", fakeTransport1.Messages.Take().FormattedMessage);
                }
            }
        }