title: Simplifying logging in Flask
body: <p>I currently have this as my basic logger for my Flask application. Although I see that there is an <a href="http://flask.pocoo.org/docs/api/#flask.Flask.logger" rel="noreferrer">Flask.logger object</a>. How do I make use of the native Flask logger? Or is what I'm doing below just fine? </p>
  
  <p>I'm also a little confused as to where the different logging statuses go, for example logging to info versus logging to error? </p>
  
  <pre><code>LOG_FILENAME = 'app_access_logs.log'
  
  info_log = logging.getLogger('app_info_log')
  info_log.setLevel(logging.INFO)
  
  handler = logging.handlers.RotatingFileHandler(
      LOG_FILENAME,
      maxBytes=1024 * 1024 * 100,
      backupCount=20
      )
  
  info_log.addHandler(handler)
  
  ...
  
  @app.before_request
  def pre_request_logging():
      #Logging statement
      if 'text/html' in request.headers['Accept']:
          info_log.info('\t'.join([
              datetime.datetime.today().ctime(),
              request.remote_addr,
              request.method,
              request.url,
              request.data,
              ', '.join([': '.join(x) for x in request.headers])])
          )
  </code></pre>