Example #1
0
 def wrapper_func(*args, **kwargs):
     exc_info = kwargs.pop('exc_info', None)
     output = self.prefix + text.decode(text.format(*args, **kwargs))
     wrapped_func(output)
     if exc_info is not None:
         for line in traceback.format_exception(*exc_info):
             wrapped_func(self.prefix + text.chomp(text.decode(line)))
Example #2
0
 def wrapper_func(*args, **kwargs):
     exc_info = kwargs.pop('exc_info', None)
     output = self.prefix + text.decode(
         text.format(*args, **kwargs))
     wrapped_func(output)
     if exc_info is not None:
         for line in traceback.format_exception(*exc_info):
             wrapped_func(self.prefix +
                          text.chomp(text.decode(line)))
Example #3
0
        def wrapper_func(*args, **kwargs):
            logger = kwargs.pop('logger', None)
            if logger is None:
                logger_kwargs = dict(default_logger_kwargs)
                logger_kwargs.setdefault('stream', kwargs.pop('log_stream', None))
                logger = get_logger(*logger_args, **logger_kwargs)

            try:
                with TrapErrors():
                    if method:
                        args[0].log = logger
                    else:
                        args = (logger,) + args
                    return wrapped_func(*args, **kwargs)

            except TrapError, exc:
                logger.error('Unhandled exception in %s', wrapped_func.func_name)
                for line in traceback.format_exception(*exc.args):
                    logger.error(text.chomp(line))
                reraise(*exc.args)
Example #4
0
        def wrapper_func(*args, **kwargs):
            logger = kwargs.pop('logger', None)
            if logger is None:
                logger_kwargs = dict(default_logger_kwargs)
                logger_kwargs.setdefault('stream',
                                         kwargs.pop('log_stream', None))
                logger = get_logger(*logger_args, **logger_kwargs)

            try:
                with TrapErrors():
                    if method:
                        args[0].log = logger
                    else:
                        args = (logger, ) + args
                    return wrapped_func(*args, **kwargs)

            except TrapError, exc:
                logger.error('Unhandled exception in %s',
                             wrapped_func.func_name)
                for line in traceback.format_exception(*exc.args):
                    logger.error(text.chomp(line))
                reraise(*exc.args)