Beispiel #1
0
        public void Should_write_extra_line_after_object()
        {
            IObjectWriter prettySut = new JsonLogWriter(Formatting.None, true);

            var result = prettySut.WriteProperty("property", 1.5).ToString();

            Assert.Equal(@"{""property"":1.5}NL".Replace("NL", Environment.NewLine), result);
        }
Beispiel #2
0
        private static string MakeTestCall(Action <IObjectWriter> writer)
        {
            IObjectWriter sut = new JsonLogWriter();

            writer(sut);

            return(sut.ToString());
        }
Beispiel #3
0
        public void Should_write_pretty_json()
        {
            IObjectWriter prettySut = new JsonLogWriter(Formatting.Indented);

            var result = prettySut.WriteProperty("property", 1.5).ToString();

            Assert.Equal(@"{NL  ""property"": 1.5NL}".Replace("NL", Environment.NewLine), result);
        }
Beispiel #4
0
        public IObjectWriter Create()
        {
            if (pool.TryPop(out var writer))
            {
                writer.Reset();
            }
            else
            {
                writer = new JsonLogWriter(formatting, formatLine);
            }

            return(writer);
        }