示例#1
0
    def __call__(self, func):
        if self.logger is None:
            LOG = logging.getLogger(func.__module__)
            self.logger = LOG.exception

        def call(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception as e:
                with excutils.save_and_reraise_exception():
                    self.logger(e)
        return call
示例#2
0
    def __call__(self, func):
        if self.logger is None:
            LOG = logging.getLogger(func.__module__)
            self.logger = LOG.exception

        def call(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception as e:
                with excutils.save_and_reraise_exception():
                    self.logger(e)

        return call
示例#3
0
def log(method):
    """Decorator helping to log method calls."""
    LOG = logging.getLogger(method.__module__)

    @functools.wraps(method)
    def wrapper(*args, **kwargs):
        instance = args[0]
        data = {"class_name": "%s.%s" % (instance.__class__.__module__,
                                         instance.__class__.__name__),
                "method_name": method.__name__,
                "args": args[1:], "kwargs": kwargs}
        LOG.debug('%(class_name)s method %(method_name)s'
                  ' called with arguments %(args)s %(kwargs)s', data)
        return method(*args, **kwargs)
    return wrapper
示例#4
0
def log(method):
    """Decorator helping to log method calls."""
    LOG = logging.getLogger(method.__module__)

    @functools.wraps(method)
    def wrapper(*args, **kwargs):
        instance = args[0]
        data = {
            "class_name":
            "%s.%s" %
            (instance.__class__.__module__, instance.__class__.__name__),
            "method_name":
            method.__name__,
            "args":
            args[1:],
            "kwargs":
            kwargs
        }
        LOG.debug(
            '%(class_name)s method %(method_name)s'
            ' called with arguments %(args)s %(kwargs)s', data)
        return method(*args, **kwargs)

    return wrapper
示例#5
0
#    under the License.

from oslo.config import cfg
from oslo import messaging
from oslo.messaging.rpc import dispatcher as rpc_dispatcher
from oslo.messaging import serializer as om_serializer
from oslo.messaging import server as msg_server

from vnfmanager.common import exceptions
from vnfmanager.common import log
from vnfmanager import context
from vnfmanager.openstack.common import log as logging
from vnfmanager.openstack.common import service


LOG = logging.getLogger(__name__)


TRANSPORT = None
NOTIFIER = None

ALLOWED_EXMODS = [
    exceptions.__name__,
]
EXTRA_EXMODS = []


TRANSPORT_ALIASES = {
    'vnfmanager.openstack.common.rpc.impl_fake': 'fake',
    'vnfmanager.openstack.common.rpc.impl_qpid': 'qpid',
    'vnfmanager.openstack.common.rpc.impl_kombu': 'rabbit',
示例#6
0
help_for_backdoor_port = (
    "Acceptable values are 0, <port>, and <start>:<end>, where 0 results "
    "in listening on a random tcp port number; <port> results in listening "
    "on the specified port number (and not enabling backdoor if that port "
    "is in use); and <start>:<end> results in listening on the smallest "
    "unused port number within the specified range of port numbers.  The "
    "chosen port is displayed in the service's log file.")
eventlet_backdoor_opts = [
    cfg.StrOpt('backdoor_port',
               default=None,
               help="Enable eventlet backdoor.  %s" % help_for_backdoor_port)
]

CONF = cfg.CONF
CONF.register_opts(eventlet_backdoor_opts)
LOG = logging.getLogger(__name__)


class EventletBackdoorConfigValueError(Exception):
    def __init__(self, port_range, help_msg, ex):
        msg = ('Invalid backdoor_port configuration %(range)s: %(ex)s. '
               '%(help)s' % {
                   'range': port_range,
                   'ex': ex,
                   'help': help_msg
               })
        super(EventletBackdoorConfigValueError, self).__init__(msg)
        self.port_range = port_range


def _dont_use_this():