title: Serilog ILogger to Microsoft ILogger?
body: <p>I am usually using injection with Serilog and ILogger but in this case I hade to create my own ILogger like this :</p>
  <pre><code>private static readonly ILogger _logger = Serilog.Log.ForContext&lt;MyClass&gt;() as ILogger;
  </code></pre>
  <p>I do however need a Microsoft ILogger instead, is there any way to create a Microsoft ILogger from Serilog or to convert a existing Serilog ILogger to Microsoft ILogger?</p>
  <p><strong>Edit 1:</strong> To be clear, the project is a .net microservice that use &quot;IHostBuilder.UseSerilog&quot; to feed the injection of Microsoft ILogger to classes. In this specific case I can however not have a ILogger injected, this would create a circular relation. So to solve this I have to manually create it within the context(example above).</p>
  <p>The problem is that this creates a Serilog ILogger while the method I need to use takes a Microsoft ILogger.</p>
  <p>So either I need to convert the Serilog ILogger to a Microsoft ILogger or even better, get Serilog to create a Microsoft ILogger.</p>
  <p>Actually, best would be if I could avoid adding more Serilog stuff into the code, it makes it harder if the log system later need to be switched.</p>
  <p><strong>Edit 2:</strong></p>
  <p>I have tried this :</p>
  <pre><code>var logger1 = Serilog.Log.ForContext&lt;MessageQueueSink&gt;() as Serilog.ILogger;
  
              logger1.Information(&quot;test1&quot;);
  
              var loggerFactorytest = new LoggerFactory()
                  .AddSerilog(logger1);
  
              var logger2 = loggerFactory.CreateLogger(&quot;Logger&quot;);
  
              logger2.LogInformation(&quot;test2&quot;);
  </code></pre>
  <p>The first &quot;test1&quot; is shown in the output but the &quot;test2&quot; is not. its now leaning more and more toward excluding logging from this part of the code.</p>