title: Serilog LogContext vs Enrich in Owin
body: <p>
  I'm trying to figure out what approach is the best:</p>
  
  <p>I have an Owin pipeline where I would like to enrich all logs with various information based on the request (URL, IP address, etc.)</p>
  
  <p>As I see it I have two possibilities with Serilog <code>ForContext()</code> in the Owin pipeline:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public override async Task Invoke(IOwinContext context)
  {
      using (LogContext.PushProperties(
          RequestUri(context),
          RemoteIp(context)))
          {
              await Next.Invoke(context);
          }
      }
  </code></pre>
  
  <p>Or set up enrichers when configuring Serilog:</p>
  
  <pre class="lang-cs prettyprint-override"><code> var configuration = new LoggerConfiguration()
       .Enrich.WithRequestUrl()
       .Enrich.WithRequestClientIp()
       ...
  </code></pre>
  
  <p>Is there a right or wrong way to do this? Personally I like the LogContext as I provides me with an easy way to access the Owin Context, but on the other hand all my requests will trigger all the enrichers to be evaluated. But then again, it is only done once during a request, instead of for each logging statement?</p>
  
  <p>Is this solely opinion-based and should therefore be closed, or is there any advantages to the one approach compared to the other?</p>