title: Using Serilog.ILogger in Azure Function
body: <p>I'm trying to use use Serilog.ILogger in my Azure function. I'm setting it up so I can add custom properties down the line. When I try to run the Azure function a console window pops up and shows the following error:</p>
  <p><a href="https://i.stack.imgur.com/Rkyia.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rkyia.png" alt="Error Message" /></a></p>
  <blockquote>
  <p>[2021-03-16T00:15:25.424Z] A host error has occurred during startup operation '6a853374-f99b-4ca4-8bde-8df8cc1e7e79'.
  [2021-03-16T00:15:25.426Z] func: Invalid host services. Microsoft.Azure.WebJobs.Script.WebHost: The following service registrations did not match the expected services:
  [2021-03-16T00:15:25.427Z]   [Missing] ServiceType: Microsoft.Extensions.Logging.ILoggerProvider, Lifetime: Singleton, ImplementationType: Microsoft.Azure.WebJobs.Script.Diagnostics.FunctionFileLoggerProvider, Microsoft.Azure.WebJobs.Script, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null</p>
  </blockquote>
  <p>This is the code that I'm using in my startup:</p>
  <pre><code> public override void Configure(IFunctionsHostBuilder builder)
      {
          var serilogLogger = new LoggerConfiguration()
              .Enrich.FromLogContext()
              .WriteTo.ApplicationInsights(TelemetryConverter.Traces)
              .CreateLogger();
          builder
              .Services
              .AddHttpClient()
              .AddLogging(l =&gt;
              {
                  l.ClearProviders();
                  l.AddSerilog(serilogLogger);
              })
              .AddSingleton(serilogLogger); 
     }
  </code></pre>
  <p>I'm also injecting an instance of ILogger&lt;&gt; into a few classes in my function too.</p>
  <p>Any thoughts of what might be going wrong here ?</p>