Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/carquinyol/__init__.py
blob: 68d961b7450c1e082b6ccc3f39f45ed6237c4e2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import logging
import decorator

# TODO: skip positional arguments by name as well
def trace(skip_args=[], skip_kwargs=[]) :
  def _trace(f, *args, **kwargs) :
    logging.debug("%s(%s)" % (f.__name__,
      ", ".join(
        [repr(a) for (idx, a) in enumerate(args) if idx not in skip_args]+\
        ['%s=%r' % (k,v) for (k,v) in kwargs.items() if k not in skip_kwargs])))

    return f(*args, **kwargs)

  return decorator.decorator(_trace)