def _run(self, application, socket): """Start a WSGI service in a new green thread.""" logger = logging.getLogger("eventlet.wsgi.server") eventlet.wsgi.server( socket, application, custom_pool=self.pool, protocol=UnixDomainHttpProtocol, log=logging.WritableLogger(logger), )
def setup_logging(conf): """ Sets up the logging options for a log with supplied name :param conf: a cfg.ConfOpts object """ product_name = "crd" logging.setup(product_name) log_root = logging.getLogger(product_name).logger LOG.info(_("Logging enabled!"))
def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using openstack's default logging system""" priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( 'crdservice.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
# License for the specific language governing permissions and limitations # under the License. from novaclient.v1_1 import client as nova_client from oslo.config import cfg import socket import json from nscs.crdservice import context as crd_context from nscs.crdservice.openstack.common import context from nscs.crdservice.openstack.common import log as logging from nscs.crdservice.openstack.common import rpc from nscs.crdservice.openstack.common.rpc import dispatcher from nscs.crdservice.openstack.common.rpc import proxy LOG = logging.getLogger(__name__) class SFCListener(proxy.RpcProxy): """ Keep listening on SFC and CRD-Consumer Notifications """ RPC_API_VERSION = '1.0' def __init__(self): self.context = crd_context.Context('crd', 'crd', is_admin=True) polling_interval = 2 reconnect_interval = 2 self.rpc = True
import sys from oslo.config import cfg import routes import webob.dec import webob.exc import configparser from nscs.crdservice.api.v2 import attributes from nscs.crdservice.common import constants from nscs.crdservice.common import exceptions import nscs.crdservice.extensions from nscs.crdservice.manager import CrdManager from nscs.crdservice.openstack.common import log as logging from nscs.crdservice import wsgi import re LOG = logging.getLogger('crdservice.api.extensions') class PluginInterface(object): __metaclass__ = ABCMeta @classmethod def __subclasshook__(cls, klass): """ The __subclasshook__ method is a class method that will be called everytime a class is tested using issubclass(klass, PluginInterface). In that case, it will check that every method marked with the abstractmethod decorator is provided by the plugin class. """
def _run(self, application, socket): """Start a WSGI server in a new green thread.""" logger = logging.getLogger('eventlet.wsgi.server') eventlet.wsgi.server(socket, application, custom_pool=self.pool, log=logging.WritableLogger(logger))