title: Adding Serilog ILogger to a static class
body: <p>I'd like to add a Serilog <code>Log</code> to a static class in my program like this (<code>DataHelper</code> is the class name):</p>
  
  <pre><code>private readonly ILogger _log = Log.ForContext&lt;DataHelper&gt;();
  </code></pre>
  
  <p>But this leads to the error message: </p>
  
  <blockquote>
    <p>static types cannot be used as type arguments</p>
  </blockquote>
  
  <p>Which makes sense. So how do I inject the logger (which is working fine in non-static classes) to this class?</p>
  
  <p><strong>Update</strong>: The answer to you referred question suggests that it is not possible. But according to Serilog's Github, <a href="http://github.com/serilog/serilog/issues/886" rel="noreferrer">there is a workaround</a>. I just need log to be aware of the class it is logging from. For now, it seems as if it is logging from the main class.</p>