<s> """<STR_LIT>""" <EOL> from time import time <EOL> from django . utils . log import getLogger <EOL> class LoggingMiddleware ( object ) : <EOL> def __init__ ( self ) : <EOL> self . logger = getLogger ( '<STR_LIT>' ) <EOL> def process_request ( self , request ) : <EOL> request . timer = time ( ) <EOL> return None <EOL> def process_response ( self , request , response ) : <EOL> if '<STR_LIT>' in request . META : <EOL> request_ip_path = '<STR_LIT>' % ( <EOL> request . META . get ( '<STR_LIT>' ) , <EOL> request . META . get ( '<STR_LIT>' ) <EOL> ) <EOL> else : <EOL> request_ip_path = request . META . get ( '<STR_LIT>' ) <EOL> self . logger . info ( <EOL> '<STR_LIT>' , <EOL> response . status_code , <EOL> request . method , <EOL> request . get_full_path ( ) , <EOL> request_ip_path , <EOL> ( time ( ) - request . timer ) * <NUM_LIT:1000> <EOL> ) <EOL> return response </s>
