code: def log_trace(logger, level=logging.DEBUG, show_enter=True, show_exit=True):
      
      def wrap(function):
          l = logger.getChild(function.__name__).log
          @wraps(function)
          def thunk(*args, **kwargs):
              global trace_depth
              trace_depth.value += 1
              try:
                  start = time()
                  if show_enter:
                      l(level, "{0}> {1} {2}".format(" "*trace_depth.value,
                                                     args, kwargs))
                  try:
                      result = function(*args, **kwargs)
                  except:
                      _, result, _ = sys.exc_info()
                      raise
                  finally:
                      if show_exit:
                          l(level, "{0}< return {1} [{2:.2f} sec]".format(
                              " "*trace_depth.value, result, time() - start))
              finally:
                  trace_depth.value -= 1
              return result
          return thunk
      return wrap
docs: log a statement on function entry and exit