Documentation Coverage Report
Current view: top level - Cqrs.WebApi/Formatters/FormMultipart/Infrastructure/Logger - FormatterLoggerAdapter.cs Hit Total Coverage
Version: 2.2 Artefacts: 4 4 100.0 %
Date: 2018-08-07 15:04:50

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="Chinchilla Software Limited">
       4             : // //   Copyright Chinchilla Software Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using System.Net.Http.Formatting;
      11             : 
      12             : namespace Cqrs.WebApi.Formatters.FormMultipart.Infrastructure.Logger
      13             : {
      14             :         /// <summary>
      15             :         /// Provide a mechanism to log issues and <see cref="Exception"/> data during conversions via a <see cref="IFormatterLogger"/>.
      16             :         /// </summary>
      17             :         internal class FormatterLoggerAdapter : IFormDataConverterLogger
      18             :         {
      19             :                 private IFormatterLogger FormatterLogger { get; set; }
      20             : 
      21             :                 /// <summary>
      22             :                 /// Instantiates a new instance of <see cref="FormatterLoggerAdapter"/>.
      23             :                 /// </summary>
      24           1 :                 public FormatterLoggerAdapter(IFormatterLogger formatterLogger)
      25             :                 {
      26             :                         if(formatterLogger == null)
      27             :                                 throw new ArgumentNullException("formatterLogger");
      28             :                         FormatterLogger = formatterLogger;
      29             :                 }
      30             : 
      31             :                 /// <summary>
      32             :                 /// Logs an error.
      33             :                 /// </summary>
      34             :                 /// <param name="errorPath">The path to the member for which the error is being logged.</param>
      35             :                 /// <param name="exception">The exception to be logged.</param>
      36           1 :                 public void LogError(string errorPath, Exception exception)
      37             :                 {
      38             :                         FormatterLogger.LogError(errorPath, exception);
      39             :                 }
      40             : 
      41             :                 /// <summary>
      42             :                 /// Logs an error.
      43             :                 /// </summary>
      44             :                 /// <param name="errorPath">The path to the member for which the error is being logged.</param>
      45             :                 /// <param name="errorMessage">The error message to be logged.</param>
      46           1 :                 public void LogError(string errorPath, string errorMessage)
      47             :                 {
      48             :                         FormatterLogger.LogError(errorPath, errorMessage);
      49             :                 }
      50             : 
      51             :                 /// <summary>
      52             :                 /// Does nothing.
      53             :                 /// </summary>
      54           1 :                 public void EnsureNoErrors() 
      55             :                 {
      56             :                         //nothing to do
      57             :                 }
      58             :         }
      59             : }

Generated by: LCOV version 1.12