title: Azure Functions - ILogger Logging across classes
body: <p>In an Azure function the run method creates an ILogger which in my main class I can use to log errors and information, however, I am using helper classes to run my Graph API and Cosmos DB queries.</p>
  <p>What is the best way to log errors and information in the separate classes, should I be passing the log in all my classes or methods? or is there a better way to make the ILogger available to all classes at runtime?</p>
  <pre><code>public class AzureFunction
  {
      public Task Run([TimerTrigger(&quot;0 0 1 * * *&quot;)] TimerInfo myTimer, ILogger log)
      {
          log.LogInformation(&quot;This message logs correctly&quot;);
          GraphHelper graphHelper = new GraphHelper();
          graphHelper.GetGraphData();
      }
  }
   
  public class GraphHelper
  {
      public void GetGraphData()
      {
          try 
          {
              asyncTask() 
          }
          catch (Exception ex) 
          {
              log.LogInformation($&quot;{ex.Message} - How can I log this without passing ILogger to every class or method?&quot;);
          }
      }
  }
       
  </code></pre>