Add support for better request info logging.

Review Request #4075 — Created April 23, 2013 and submitted

Information

Djblets
master

Reviewers

Add support for better request info logging.

This adds support for a 'request' parameter to Python's logging calls.
When provided, we'll log the request information (customizable by the
the project). By default, this will show the user and the path.

This information makes it much easier to see who's triggering what
problems or code paths.

It's a bit evil that we're hijacking the root logger's _log function,
but it should be safe in all versions of Python we support.

Other call sites have been updated to provide a request when possible.
However, they pass the request using Python logging's 'extra' parameter
instead of our new request parameter, so that any existing apps don't
suddenly break if they don't use djblets.log.

Some call sites (such as the cache_memoize code) don't provide a
request, since they have none. Unfortunately, in these cases, we just
won't have this additional information.
Unit tests for Djblets pass.

Also tested RB and RBC tests (with call sites converted).

Did some manual testing of loading diffs and saw request info when available.
Also saw that those without requests didn't break (such as the cache_memoize
calls).
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        djblets/log/__init__.py
        djblets/datagrid/grids.py
        djblets/webapi/auth.py
      Ignored Files:
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (dd36f1c)
Loading...