From 508666fbfa3dc9dc6510496bd28e90a79dd1d858 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Tue, 20 Nov 2012 11:49:33 +1300 Subject: [PATCH] -Documentation --- Doc/SerializationSettings.aml | 8 +++--- Doc/SerializationTracing.aml | 8 +++--- Doc/doc.content | 2 +- .../Documentation/TraceWriterTests.cs | 25 ++++++++++--------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Doc/SerializationSettings.aml b/Doc/SerializationSettings.aml index c518de8e..029f62c4 100644 --- a/Doc/SerializationSettings.aml +++ b/Doc/SerializationSettings.aml @@ -340,11 +340,11 @@ or a property's object properties or collection items using
TraceWriter - The Json.NET serializer supports logging using the T:Newtonsoft.Json.Serialization.ITraceWriter - interface. By assigning a trace writer you can debug what is happening inside the Json.NET serializer when - serializing and deserializing JSON. + The Json.NET serializer supports logging and debugging using the + T:Newtonsoft.Json.Serialization.ITraceWriter interface. + By assigning a trace writer you can debug what happens inside the Json.NET serializer when serializing and deserializing JSON. Read more about TraceWriters here: -Debug with Serialization Tracing +Debugging with Serialization Tracing SerializationTracing.htm _self diff --git a/Doc/SerializationTracing.aml b/Doc/SerializationTracing.aml index 39c32a12..9118072c 100644 --- a/Doc/SerializationTracing.aml +++ b/Doc/SerializationTracing.aml @@ -2,9 +2,9 @@ - The Json.NET serializer supports logging using the T:Newtonsoft.Json.Serialization.ITraceWriter - interface. By assigning a trace writer you can debug what is happening inside the Json.NET serializer when - serializing and deserializing JSON. + The Json.NET serializer supports logging and debugging using the + T:Newtonsoft.Json.Serialization.ITraceWriter interface. + By assigning a trace writer you can debug what happens inside the Json.NET serializer when serializing and deserializing JSON.
ITraceWriter @@ -13,7 +13,7 @@ - Json.NET has two implementations of ITraceWriter: P:Newtonsoft.Json.Serialization.MemoryTraceWriter + Json.NET has two implementations of ITraceWriter: T:Newtonsoft.Json.Serialization.MemoryTraceWriter which keeps messages in memory for simple debugging like the example above, and T:Newtonsoft.Json.Serialization.DiagnosticsTraceWriter which writes messages to any System.Diagnostics.TraceListeners your application is using. diff --git a/Doc/doc.content b/Doc/doc.content index 18929205..3c3d5b7c 100644 --- a/Doc/doc.content +++ b/Doc/doc.content @@ -15,7 +15,7 @@ - + diff --git a/Src/Newtonsoft.Json.Tests/Documentation/TraceWriterTests.cs b/Src/Newtonsoft.Json.Tests/Documentation/TraceWriterTests.cs index 9c047486..f103ec75 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/TraceWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/TraceWriterTests.cs @@ -98,6 +98,19 @@ namespace Newtonsoft.Json.Tests.Documentation get { return TraceLevel.Verbose; } } + public void Trace(TraceLevel level, string message, Exception ex) + { + LogEventInfo logEvent = new LogEventInfo + { + Message = message, + Level = GetLogLevel(level), + Exception = ex + }; + + // log Json.NET message to NLog + Logger.Log(logEvent); + } + private LogLevel GetLogLevel(TraceLevel level) { switch (level) @@ -114,18 +127,6 @@ namespace Newtonsoft.Json.Tests.Documentation return LogLevel.Trace; } } - - public void Trace(TraceLevel level, string message, Exception ex) - { - LogEventInfo logEvent = new LogEventInfo - { - Message = message, - Level = GetLogLevel(level), - Exception = ex - }; - - Logger.Log(logEvent); - } } #endregion