title: How to pass ILogger to my filter
body: <p>I have an ASP.NET Web APi Service.</p>
  
  <p>I have added a global error exception routine using IExceptionFilter.</p>
  
  <p>To register the service I have this in my StartUp.cs:</p>
  
  <pre><code>services.AddMvc(options =&gt;
  {
      options.Filters.Add(new ErrorHandlingFilter()); 
  });
  </code></pre>
  
  <p>My Exception Filter Class is this:</p>
  
  <pre><code>public class ErrorHandlingFilter : ApiControllerBase, IExceptionFilter
  {
      public ErrorHandlingFilter(ILogWriter logger) : base(logger)
      {
  
      }
  
  
      public void OnException(ExceptionContext filterContext)
      {
  
          // If our exception has been handled, exit the function
          if (filterContext.ExceptionHandled)
          {
              return;
          }
  
          // Set our handled property to true
          filterContext.Result = new StatusCodeResult(500);
          filterContext.ExceptionHandled = true;
      }
  }
  </code></pre>
  
  <p>But, obviously, I get a compile error at this line here: </p>
  
  <pre><code> options.Filters.Add(new ErrorHandlingFilter()); 
  </code></pre>
  
  <p>because it is expecting me to pass an instance of ILogger.</p>
  
  <p>But I define Ilogger here: </p>
  
  <pre><code>// Add singleton instance to the application for the LogWriter class
  services.AddSingleton&lt;ILogWriter, LogWriter&gt;();
  
  // Add singleton instance to the application for the NLog Logger which is used within the LogWriter implementation
  services.AddSingleton(typeof(ILogger), LogManager.GetLogger("WebApi.Host"));
  </code></pre>
  
  <p>So, how can I pass an instance to my Exception Filter without duplication?</p>
  
  <p>NB
  I admit this could be daft question, but it is very hot so brain is frazzled..</p>