<s> from __future__ import absolute_import <EOL> from contextlib import contextmanager <EOL> import logging <EOL> import time <EOL> def make_timing_logger ( logger , precision = <NUM_LIT:3> , level = logging . DEBUG ) : <EOL> """<STR_LIT>""" <EOL> @ contextmanager <EOL> def log_time ( msg , * args ) : <EOL> """<STR_LIT>""" <EOL> start_time = time . time ( ) <EOL> try : <EOL> yield <EOL> finally : <EOL> message = "<STR_LIT>" . format ( msg , precision ) <EOL> duration = time . time ( ) - start_time <EOL> args = args + ( duration , ) <EOL> logger . log ( level , message , * args ) <EOL> return log_time </s>
