Merge "Use openstack common log to do logging."
This commit is contained in:
commit
eda6342d57
@ -1,23 +1,29 @@
|
||||
[DEFAULT]
|
||||
# Default log level is WARNING
|
||||
# Show debugging output in logs (sets DEBUG log level output)
|
||||
# Default log level is INFO
|
||||
# verbose and debug has the same result.
|
||||
# One of them will set DEBUG log level output
|
||||
# debug = False
|
||||
|
||||
# Show more verbose log output (sets INFO log level output) if debug is False
|
||||
# verbose = False
|
||||
|
||||
# log_format = %(asctime)s %(levelname)8s [%(name)s] %(message)s
|
||||
# log_date_format = %Y-%m-%d %H:%M:%S
|
||||
|
||||
# use_syslog -> syslog
|
||||
# log_file and log_dir -> log_dir/log_file
|
||||
# (not log_file) and log_dir -> log_dir/{binary_name}.log
|
||||
# use_stderr -> stderr
|
||||
# (not user_stderr) and (not log_file) -> stdout
|
||||
# publish_errors -> notification system
|
||||
|
||||
# use_syslog = False
|
||||
# syslog_log_facility = LOG_USER
|
||||
|
||||
# if use_syslog is False, we can set log_file and log_dir.
|
||||
# if use_syslog is False and we do not set log_file,
|
||||
# the log will be printed to stdout.
|
||||
# use_stderr = True
|
||||
# log_file =
|
||||
# log_dir =
|
||||
|
||||
# publish_errors = False
|
||||
|
||||
# Address to bind the API server
|
||||
bind_host = 0.0.0.0
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
@ -37,6 +36,7 @@ from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import context
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import jsonutils
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common.rpc import proxy
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -19,7 +19,6 @@
|
||||
#
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
|
||||
@ -33,6 +32,7 @@ from quantum.agent.linux import utils
|
||||
from quantum.db import l3_db
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantumclient.v2_0 import client
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -16,7 +16,6 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
@ -30,6 +29,7 @@ from quantum.agent.linux import ip_lib
|
||||
from quantum.agent.linux import utils
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import jsonutils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
import logging
|
||||
|
||||
import netaddr
|
||||
|
||||
@ -27,6 +26,7 @@ from quantum.common import exceptions
|
||||
from quantum.extensions.flavor import (FLAVOR_NETWORK)
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -22,10 +22,10 @@
|
||||
"""Implements iptables rules using linux utilities."""
|
||||
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
|
||||
from quantum.agent.linux import utils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
# NOTE(vish): Iptables supports chain names of up to 28 characters, and we
|
||||
|
@ -18,10 +18,10 @@
|
||||
# @author: Dan Wendlandt, Nicira Networks, Inc.
|
||||
# @author: Dave Lapsley, Nicira Networks, Inc.
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from quantum.agent.linux import utils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
# @author: Juliano Martinez, Locaweb.
|
||||
|
||||
import fcntl
|
||||
import logging
|
||||
import os
|
||||
import shlex
|
||||
import signal
|
||||
@ -28,7 +27,7 @@ import struct
|
||||
from eventlet.green import subprocess
|
||||
|
||||
from quantum.common import utils
|
||||
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
|
||||
@ -13,6 +12,7 @@ from quantum.api.v2 import attributes
|
||||
from quantum.common import config
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
NS_MANGLING_PATTERN = ('(%s|%s)' % (dhcp_agent.NS_PREFIX, l3_agent.NS_PREFIX) +
|
||||
|
@ -13,12 +13,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
|
||||
import eventlet
|
||||
|
||||
from quantum.common import topics
|
||||
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import rpc
|
||||
from quantum.openstack.common.rpc import proxy
|
||||
from quantum.openstack.common.notifier import api
|
||||
|
@ -15,10 +15,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from webob import exc
|
||||
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -17,12 +17,11 @@ ATTR_NOT_SPECIFIED = object()
|
||||
# Defining a constant to avoid repeating string literal in several modules
|
||||
SHARED = 'shared'
|
||||
|
||||
import logging
|
||||
import netaddr
|
||||
import re
|
||||
|
||||
from quantum.common import exceptions as q_exc
|
||||
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import socket
|
||||
|
||||
import webob.exc
|
||||
@ -22,6 +21,7 @@ from quantum.api.v2 import attributes
|
||||
from quantum.api.v2 import resource as wsgi_resource
|
||||
from quantum.common import exceptions
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common.notifier import api as notifier_api
|
||||
from quantum import policy
|
||||
from quantum import quota
|
||||
|
@ -16,7 +16,6 @@
|
||||
"""
|
||||
Utility methods for working with WSGI servers redux
|
||||
"""
|
||||
import logging
|
||||
|
||||
import webob
|
||||
import webob.dec
|
||||
@ -25,6 +24,7 @@ import webob.exc
|
||||
from quantum.common import exceptions
|
||||
from quantum import context
|
||||
from quantum.openstack.common import jsonutils as json
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum import wsgi
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import urlparse
|
||||
|
||||
import routes as routes_mapper
|
||||
@ -26,6 +25,7 @@ from quantum.api.v2 import base
|
||||
from quantum.extensions import extensions
|
||||
from quantum import manager
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum import wsgi
|
||||
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import webob.dec
|
||||
|
||||
from quantum.api.views import versions as versions_view
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum import wsgi
|
||||
|
||||
|
||||
|
@ -14,15 +14,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
from quantum import context
|
||||
from quantum import wsgi
|
||||
from quantum.openstack.common import cfg
|
||||
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -19,9 +19,6 @@
|
||||
Routines for configuring Quantum
|
||||
"""
|
||||
|
||||
import logging
|
||||
import logging.config
|
||||
import logging.handlers
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -29,9 +26,9 @@ from paste import deploy
|
||||
|
||||
from quantum.api.v2 import attributes
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.version import version_string
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
core_opts = [
|
||||
@ -79,45 +76,10 @@ def setup_logging(conf):
|
||||
|
||||
:param conf: a cfg.ConfOpts object
|
||||
"""
|
||||
|
||||
if conf.log_config:
|
||||
# Use a logging configuration file for all settings...
|
||||
if os.path.exists(conf.log_config):
|
||||
logging.config.fileConfig(conf.log_config)
|
||||
return
|
||||
else:
|
||||
raise RuntimeError("Unable to locate specified logging "
|
||||
"config file: %s" % conf.log_config)
|
||||
|
||||
root_logger = logging.root
|
||||
if conf.debug:
|
||||
root_logger.setLevel(logging.DEBUG)
|
||||
elif conf.verbose:
|
||||
root_logger.setLevel(logging.INFO)
|
||||
else:
|
||||
root_logger.setLevel(logging.WARNING)
|
||||
|
||||
formatter = logging.Formatter(conf.log_format, conf.log_date_format)
|
||||
|
||||
if conf.use_syslog:
|
||||
try:
|
||||
facility = getattr(logging.handlers.SysLogHandler,
|
||||
conf.syslog_log_facility)
|
||||
except AttributeError:
|
||||
raise ValueError(_("Invalid syslog facility"))
|
||||
|
||||
handler = logging.handlers.SysLogHandler(address='/dev/log',
|
||||
facility=facility)
|
||||
elif conf.log_file:
|
||||
logfile = conf.log_file
|
||||
if conf.log_dir:
|
||||
logfile = os.path.join(conf.log_dir, logfile)
|
||||
handler = logging.handlers.WatchedFileHandler(logfile)
|
||||
else:
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
|
||||
handler.setFormatter(formatter)
|
||||
root_logger.addHandler(handler)
|
||||
product_name = "quantum"
|
||||
logging.setup(product_name)
|
||||
log_root = logging.getLogger(product_name).logger
|
||||
log_root.propagate = 0
|
||||
LOG.info("Logging enabled!")
|
||||
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
"""Utilities and helper functions."""
|
||||
|
||||
|
||||
import logging
|
||||
import os
|
||||
import signal
|
||||
import uuid
|
||||
@ -29,8 +28,10 @@ import uuid
|
||||
from eventlet.green import subprocess
|
||||
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def boolize(subject):
|
||||
@ -60,7 +61,7 @@ def read_cached_file(filename, cache_info, reload_func=None):
|
||||
"""
|
||||
mtime = os.path.getmtime(filename)
|
||||
if not cache_info or mtime != cache_info.get('mtime'):
|
||||
logging.debug(_("Reloading cached file %s") % filename)
|
||||
LOG.debug(_("Reloading cached file %s") % filename)
|
||||
with open(filename) as fap:
|
||||
cache_info['data'] = fap.read()
|
||||
cache_info['mtime'] = mtime
|
||||
|
@ -18,12 +18,14 @@
|
||||
"""Context: context for security/db session."""
|
||||
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from quantum.db import api as db_api
|
||||
from quantum.openstack.common import context as common_context
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
# @author: Brad Hall, Nicira Networks, Inc.
|
||||
# @author: Dan Wendlandt, Nicira Networks, Inc.
|
||||
|
||||
import logging
|
||||
import time
|
||||
|
||||
import sqlalchemy as sql
|
||||
@ -26,6 +25,7 @@ from sqlalchemy.exc import DisconnectionError
|
||||
from sqlalchemy.orm import sessionmaker, exc
|
||||
|
||||
from quantum.db import model_base
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import random
|
||||
|
||||
import netaddr
|
||||
@ -28,6 +27,7 @@ from quantum.common import utils
|
||||
from quantum.db import api as db
|
||||
from quantum.db import models_v2
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import timeutils
|
||||
from quantum import quantum_plugin_base_v2
|
||||
|
||||
|
@ -13,14 +13,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from quantum import context as quantum_context
|
||||
from quantum import manager
|
||||
from quantum.api.v2 import attributes
|
||||
from quantum.openstack.common import context
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -19,8 +19,6 @@
|
||||
#
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
import netaddr
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
@ -36,6 +34,8 @@ from quantum.db import model_base
|
||||
from quantum.db import models_v2
|
||||
from quantum.extensions import l3
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
from quantum import policy
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
from abc import ABCMeta
|
||||
import imp
|
||||
import logging
|
||||
import os
|
||||
|
||||
import routes
|
||||
@ -31,6 +30,7 @@ import quantum.extensions
|
||||
from quantum.manager import QuantumManager
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum import wsgi
|
||||
|
||||
|
||||
|
@ -15,9 +15,8 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from quantum.api.v2 import attributes
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -23,11 +23,10 @@ class.
|
||||
The caller should make sure that QuantumManager is a singleton.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from quantum.common.exceptions import ClassNotFound
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -22,7 +22,6 @@
|
||||
# Quantum OpenVSwitch Plugin.
|
||||
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@ -38,12 +37,13 @@ from quantum.common import constants
|
||||
from quantum.common import topics
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import context
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import rpc
|
||||
from quantum.openstack.common.rpc import dispatcher
|
||||
from quantum.plugins.linuxbridge.common import config
|
||||
from quantum.plugins.linuxbridge.common import constants as lconst
|
||||
|
||||
logging.basicConfig()
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
BRIDGE_NAME_PREFIX = "brq"
|
||||
|
@ -13,7 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
@ -21,6 +20,7 @@ from quantum.common import exceptions as q_exc
|
||||
import quantum.db.api as db
|
||||
from quantum.db import models_v2
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.plugins.linuxbridge.common import config
|
||||
from quantum.plugins.linuxbridge.common import constants
|
||||
from quantum.plugins.linuxbridge.db import l2network_models_v2
|
||||
|
@ -13,7 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from quantum.api.v2 import attributes
|
||||
@ -28,6 +27,7 @@ from quantum.db import models_v2
|
||||
from quantum.extensions import providernet as provider
|
||||
from quantum.openstack.common import context
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import rpc
|
||||
from quantum.openstack.common.rpc import dispatcher
|
||||
from quantum.openstack.common.rpc import proxy
|
||||
|
@ -20,7 +20,6 @@
|
||||
# @author: Dave Lapsley, Nicira Networks, Inc.
|
||||
# @author: Aaron Rosen, Nicira Networks, Inc.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
|
||||
@ -35,12 +34,13 @@ from quantum.common import config as logging_config
|
||||
from quantum.common import topics
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import context
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import rpc
|
||||
from quantum.openstack.common.rpc import dispatcher
|
||||
from quantum.plugins.openvswitch.common import config
|
||||
from quantum.plugins.openvswitch.common import constants
|
||||
|
||||
logging.basicConfig()
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
# A placeholder for dead vlans.
|
||||
@ -687,8 +687,6 @@ def create_agent_config_map(config):
|
||||
def main():
|
||||
eventlet.monkey_patch()
|
||||
cfg.CONF(args=sys.argv, project='quantum')
|
||||
|
||||
# (TODO) gary - swap with common logging
|
||||
logging_config.setup_logging(cfg.CONF)
|
||||
|
||||
try:
|
||||
|
@ -16,14 +16,13 @@
|
||||
# @author: Aaron Rosen, Nicira Networks, Inc.
|
||||
# @author: Bob Kukura, Red Hat, Inc.
|
||||
|
||||
import logging
|
||||
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from quantum.common import exceptions as q_exc
|
||||
from quantum.db import models_v2
|
||||
import quantum.db.api as db
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.plugins.openvswitch.common import constants
|
||||
from quantum.plugins.openvswitch import ovs_models_v2
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
# @author: Aaron Rosen, Nicira Networks, Inc.
|
||||
# @author: Bob Kukura, Red Hat, Inc.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -34,6 +33,7 @@ from quantum.db import l3_db
|
||||
from quantum.extensions import providernet as provider
|
||||
from quantum.openstack.common import context
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import rpc
|
||||
from quantum.openstack.common.rpc import dispatcher
|
||||
from quantum.openstack.common.rpc import proxy
|
||||
|
@ -18,12 +18,12 @@
|
||||
"""
|
||||
Policy engine for quantum. Largely copied from nova.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from quantum.api.v2 import attributes
|
||||
from quantum.common import exceptions
|
||||
from quantum.openstack.common import cfg
|
||||
import quantum.common.utils as utils
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common import policy
|
||||
|
||||
|
||||
|
@ -16,11 +16,10 @@
|
||||
|
||||
"""Quotas for instances, volumes, and floating ips."""
|
||||
|
||||
import logging
|
||||
|
||||
from quantum.common import exceptions
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import importutils
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
quota_opts = [
|
||||
|
@ -15,10 +15,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from quantum.common import config
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum import wsgi
|
||||
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
"""
|
||||
Utility methods for working with WSGI servers
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from xml.dom import minidom
|
||||
from xml.parsers import expat
|
||||
@ -34,22 +32,11 @@ import webob.exc
|
||||
from quantum.common import exceptions as exception
|
||||
from quantum import context
|
||||
from quantum.openstack.common import jsonutils
|
||||
|
||||
from quantum.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class WritableLogger(object):
|
||||
"""A thin wrapper that responds to `write` and logs."""
|
||||
|
||||
def __init__(self, logger, level=logging.DEBUG):
|
||||
self.logger = logger
|
||||
self.level = level
|
||||
|
||||
def write(self, msg):
|
||||
self.logger.log(self.level, msg.strip("\n"))
|
||||
|
||||
|
||||
def run_server(application, port):
|
||||
"""Run a WSGI server with the given application."""
|
||||
sock = eventlet.listen(('0.0.0.0', port))
|
||||
@ -79,7 +66,7 @@ class Server(object):
|
||||
"""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=WritableLogger(logger))
|
||||
log=logging.WritableLogger(logger))
|
||||
|
||||
|
||||
class Middleware(object):
|
||||
|
Loading…
Reference in New Issue
Block a user