title: Logging within a package
body: <p>I'm developing a package that will be used by others to write processing scripts. For testing/debugging/not-going-insane purposes, I'd like to include some logging statements within my code, and especially using a <code>logging_setup()</code> utility function that I developed for another project for formatting/file output control.</p>
  
  <p>Because I'm not writing a self-contained application, however, but a library that is meant to be called by other programs, I am confused where I should use my <code>logging_setup()</code> utility in order to produce the desired logging results that I want. This made me wonder whether using a logging system within my package was a good idea to begin with.</p>
  
  <p>Where should I use my <code>logging_setup()</code> utility, if anywhere?</p>
  
  <p>EDIT: Here's the function I mention above:</p>
  
  <pre><code>def logging_setup(cfg_path=definitions.LOG_CONFIG_PATH, lvl=logging.INFO):
      """Setup logging tool from YAML configuration file.
  
      This should only be run once. Formatted (or configured) logging can only be
      done from within functions/classes in other modules.
      """
  
      # create directory for log files if not already there
      try:
          os.makedirs(definitions.LOGS_PATH)
      except OSError as e:
          if e.errno != errno.EEXIST:
              raise
  
      # configure logging from yaml config file
      if os.path.exists(cfg_path):
          with open(cfg_path, 'rt') as f:
              config = yaml.safe_load(f.read())
  
          logging.config.dictConfig(config)
  
      else:
          logging.basicConfig(level=lvl)
  </code></pre>