title: How to use Microsoft.Extensions.Logging.ILogger as class variable in Azure FunctionApp?
body: <p><strong><em>Question :</em></strong> </p>
  
  <p>How to declare a ILogger as class variable and use them for logging ?</p>
  
  <p><strong>*NOTES : *</strong></p>
  
  <ol>
  <li><p>I need to develop Azure Function App where TraceWritter is used as default.
  While writting UnitTest, TraceWritter is difficult. Instead iam using ILogger.</p></li>
  <li><p>In funtion app , iam passing the log variable to all methods from Initial RUN Method. ( This is not the right way to do this. )</p></li>
  <li><p>I need to declare ILogger as a class Variable and use them in all places.</p></li>
  </ol>
  
  <p>so , How to do this.</p>
  
  <p><strong><em>Sample Code</em></strong></p>
  
  <pre><code>public class addClass
      {
        //  private static ILogger LOGGER = ---???-----  // I need to declare here.
  
          private void add(ILogger log)       // Iam using like this. This is not rite way of programming to pass to all methods.
          {
            int a = 10;
            int b=4;
  
                  log.LogInformation((a+b));
  
          }
  
          private void addM()     // Using the class variable.    
          {
            int a = 10;
            int b = 4;
  
                  log.LogInformation((a+b));
  
          }
      }
  </code></pre>
  
  <p>Help me out of this. Thanks in advance.</p>