|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Globalization; |
4 | | -using System.IO; |
5 | 4 | using Newtonsoft.Json; |
6 | 5 | using Newtonsoft.Json.Converters; |
7 | 6 | using Newtonsoft.Json.Serialization; |
@@ -179,64 +178,4 @@ public DiagnosticMessage( |
179 | 178 | this.PlaintextMessage = plaintextMessage; |
180 | 179 | } |
181 | 180 | } |
182 | | - |
183 | | - /// <summary> |
184 | | - /// Provides the ability to write diagnostic messages to some output. |
185 | | - /// </summary> |
186 | | - public interface IDiagnosticsWriter |
187 | | - { |
188 | | - /// <summary> |
189 | | - /// Adds <paramref name="message" /> as a new diagnostics entry. |
190 | | - /// </summary> |
191 | | - /// <param name="message">The diagnostics entry to add.</param> |
192 | | - void AddEntry(DiagnosticMessage message); |
193 | | - } |
194 | | - |
195 | | - /// <summary> |
196 | | - /// A wrapper around an underlying <see cref="StreamWriter" /> which allows |
197 | | - /// <see cref="DiagnosticMessage" /> objects to be serialized to it. |
198 | | - /// </summary> |
199 | | - public sealed class DiagnosticsStream : IDiagnosticsWriter, IDisposable |
200 | | - { |
201 | | - private readonly JsonSerializer serializer; |
202 | | - private readonly StreamWriter writer; |
203 | | - |
204 | | - /// <summary> |
205 | | - /// Initialises a new <see cref="DiagnosticsStream" /> for a file at <paramref name="path" />. |
206 | | - /// </summary> |
207 | | - /// <param name="path">The path to the file that should be created.</param> |
208 | | - public DiagnosticsStream(string path) |
209 | | - { |
210 | | - this.writer = File.CreateText(path); |
211 | | - |
212 | | - var contractResolver = new DefaultContractResolver |
213 | | - { |
214 | | - NamingStrategy = new CamelCaseNamingStrategy() |
215 | | - }; |
216 | | - |
217 | | - serializer = new JsonSerializer |
218 | | - { |
219 | | - ContractResolver = contractResolver, |
220 | | - NullValueHandling = NullValueHandling.Ignore |
221 | | - }; |
222 | | - } |
223 | | - |
224 | | - /// <summary> |
225 | | - /// Adds <paramref name="message" /> as a new diagnostics entry. |
226 | | - /// </summary> |
227 | | - /// <param name="message">The diagnostics entry to add.</param> |
228 | | - public void AddEntry(DiagnosticMessage message) |
229 | | - { |
230 | | - serializer.Serialize(writer, message); |
231 | | - writer.Flush(); |
232 | | - } |
233 | | - |
234 | | - /// <summary> |
235 | | - /// Releases all resources used by the <see cref="DiagnosticsStream" /> object. |
236 | | - /// </summary> |
237 | | - public void Dispose() |
238 | | - { |
239 | | - writer.Dispose(); |
240 | | - } |
241 | | - } |
242 | 181 | } |
0 commit comments