コード例 #1
0
        def wrapper(*args, **kwargs):
            fname = '%s.%s' % (f.__module__, f.__name__)
            _args = ', '.join(
                chain(
                    (repr(arg) for arg in args),
                    ('%s=%s' % (k, repr(v)) for (k, v) in kwargs.items()),
                )) if with_args else '...'

            _debug.begin('%s(%s): ...' % (fname, _args))
            try:
                ret = f(*args, **kwargs)
            except:
                try:
                    (exctype, value) = sys.exc_info()[:2]
                    _debug.end('%s(...): %s(%s)' % (fname, exctype, value))
                finally:
                    exctype = value = None
                raise
            else:
                _debug.end('%s(...): %s' %
                           (fname, repr(ret) if with_return else '...'))
                return ret
コード例 #2
0
    def __del__(self):
        """
		Log the end of function.
		"""
        _debug.end(self.fname)