title: How should logging be used in a Python package?
body: <p>I am currently developing a package which can be used without writing any new code and the modules can be used to develop new code (see <a href="https://pythonhosted.org/hwrt/" rel="noreferrer">documentation</a>).</p>
  
  <p>Many of my modules use <a href="https://docs.python.org/2/library/logging.html" rel="noreferrer"><code>logging</code></a> in a very simple way:</p>
  
  <pre><code>import logging
  import sys
  logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                      level=logging.DEBUG,
                      stream=sys.stdout)
  # Code of the module follows
  </code></pre>
  
  <p>I have these lines in many modules. It seems to me that I should factor it out, but I am not sure what the best / recommended / most pythonic way to do so is.</p>
  
  <p>The relevant parts in the logging documentation seem to be <a href="https://docs.python.org/2/howto/logging.html#configuring-logging-for-a-library" rel="noreferrer">Configuring Logging for a Library</a> and 
  <a href="https://docs.python.org/2/howto/logging.html#logging-from-multiple-modules" rel="noreferrer">Logging from multiple modules</a>.</p>
  
  <p>I guess I should simply move the line <code>logging.basicConfig</code> to the executables (<code>bin/hwrt</code>) and remove all other <code>logging.basicConfig</code> lines.</p>
  
  <p>Is there any rule how packages should use logging (like PEP8 for coding style)?</p>
  
  <p>If other developers use my code they might want to disable / modify the way my package does logging (so that it doesn't get mixed with their logging calls). Is there a way to help them do so?</p>