edo it', level=logging.INFO): ... time.sleep(0.02) Took ... to redo it It can also be used as a function decorator to log the time elapsed to run the decorated function. >>> @timer() ... def test1(): ... time.sleep(0.01) >>> @timer('run test 2', level=logging.INFO) ... def test2(): ... time.sleep(0.02) >>> test1() Took ... to run 'test1' >>> test2() Took ... to run test 2 z