title: Mask out sensitive information in python log
body: <p>Consider the following code</p>
  
  <pre><code>try:
      r = requests.get('https://sensitive:passw0rd@what.ever/')
      r.raise_for_status()
  except requests.HTTPError:
      logging.exception("Failed to what.ever")
  </code></pre>
  
  <p>Here, if the endpoint returns non-successful http status code, the following will be logged</p>
  
  <pre><code>Traceback (most recent call last):
    File "a.py", line 5, in &lt;module&gt;
      r.raise_for_status()
    File "venv/lib/python3.5/site-packages/requests/models.py", line 928, in raise_for_status
      raise HTTPError(http_error_msg, response=self)
  requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://sensitive:passw0rd@what.ever/
  </code></pre>
  
  <p>The problem is that the <em>password</em> is logged. I could create a logging filter to filter out this line completely. However, it would be more convenient if the password was just masked out somehow. As no string is passed to <code>logging.exception</code> filtering on the app side is tricky. Where in the logging framwork can I transform a log record?</p>