title: Logging from static methods
body: <p>In a class with few no static functions, I typically do logging like this:</p>
  
  <pre><code>class ClassA:
  
      def __init__(self):
          self._logger = logging.getLogger(self.__class__.__name__)
  
      def do_something(self):
          self._logger.info("Doing something")
  
      def do_something_else(self):
          self._logger.info("Doing something else.")
  </code></pre>
  
  <p>In a class with static methods I've been doing this:</p>
  
  <pre><code>class ClassB:
  
      _logger = logging.getLogger("ClassB")
  
      @staticmethod
      def do_something():
          ClassB._logger.info("Doing something")
  
      @staticmethod
      def do_something_else():
          ClassB._logger.info("Doing something else")
  </code></pre>
  
  <p>You could do this but it seems lame:</p>
  
  <pre><code>class ClassB:
  
      @staticmethod
      def do_something():
          logger = logging.getLogger("ClassB")
          logger.info("Doing something")
  
      @staticmethod
      def do_something_else():
          logger = logging.getLogger("ClassB")
          logger.info("Doing something else")
  </code></pre>
  
  <p>Is there a better pattern for logging from static methods?</p>