replace logging with oslo.log
oslo.log provides more features and is a fundamental recommended library to use. Also the library oslo.log provides compatibility for log levels, logging namespace is not needed. Change-Id: I5636cdf3f804d4f811bd05add3fb42c0beea58a2
This commit is contained in:
parent
efdc8f139c
commit
b9ce7e5903
@ -13,11 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
cfg.CONF.register_group(cfg.OptGroup(
|
||||
|
@ -16,8 +16,8 @@
|
||||
# under the License.
|
||||
|
||||
import json as jsonutils
|
||||
import logging
|
||||
|
||||
from oslo_log import log
|
||||
from six.moves.urllib import parse
|
||||
import requests
|
||||
|
||||
@ -25,7 +25,7 @@ from designate.backend.impl_infoblox.config import cfg
|
||||
from designate.backend.impl_infoblox import ibexceptions as exc
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class Infoblox(object):
|
||||
|
@ -15,13 +15,14 @@
|
||||
|
||||
|
||||
import gettext
|
||||
import logging
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from designate.backend.impl_infoblox import ibexceptions as exc
|
||||
|
||||
_ = gettext.gettext
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class InfobloxObjectManipulator(object):
|
||||
|
@ -15,11 +15,10 @@
|
||||
# under the License.
|
||||
import sys
|
||||
import functools
|
||||
import logging as logmodule
|
||||
|
||||
import pkg_resources
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_log import log
|
||||
from stevedore import hook
|
||||
|
||||
|
||||
@ -28,19 +27,19 @@ class HookLog(object):
|
||||
messages for later use.
|
||||
"""
|
||||
LVLS = dict(
|
||||
debug=logmodule.DEBUG,
|
||||
info=logmodule.INFO,
|
||||
warning=logmodule.WARNING,
|
||||
error=logmodule.ERROR,
|
||||
critical=logmodule.CRITICAL,
|
||||
exception=logmodule.ERROR,
|
||||
debug=log.DEBUG,
|
||||
info=log.INFO,
|
||||
warning=log.WARNING,
|
||||
error=log.ERROR,
|
||||
critical=log.CRITICAL,
|
||||
exception=log.ERROR,
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
self.messages = []
|
||||
|
||||
def log(self, logger=None):
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = log.getLogger(__name__)
|
||||
for level, msg, args, kw in self.messages:
|
||||
logger.log(level, msg, *args, **kw)
|
||||
|
||||
@ -95,7 +94,7 @@ class BaseHook(object):
|
||||
|
||||
class hook_point(object):
|
||||
NAMESPACE = 'designate.hook_point'
|
||||
LOG_LEVEL = logmodule.INFO
|
||||
LOG_LEVEL = log.INFO
|
||||
|
||||
def __init__(self, name=None):
|
||||
self._name = name
|
||||
|
@ -13,14 +13,14 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import logging
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from designate.network_api.base import NetworkAPI
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
cfg.CONF.register_opts([
|
||||
cfg.StrOpt('network_api', default='neutron', help='Which API to use.')
|
||||
|
@ -13,12 +13,13 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import logging
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from designate.notification_handler.base import NotificationHandler
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
def get_notification_handlers(enabled_extensions):
|
||||
|
@ -11,8 +11,8 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import logging
|
||||
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from designate import objects
|
||||
@ -20,7 +20,7 @@ from designate import exceptions
|
||||
from designate.i18n import _LE
|
||||
from designate.i18n import _LI
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class DesignateObjectAdapterMetaclass(type):
|
||||
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from designate import exceptions
|
||||
@ -26,7 +26,7 @@ from designate.objects.validation_error import ValidationError
|
||||
from designate.objects.validation_error import ValidationErrorList
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
cfg.CONF.import_opt('supported_record_type', 'designate')
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import logging
|
||||
|
||||
import six
|
||||
import sqlalchemy
|
||||
@ -24,13 +23,14 @@ from sqlalchemy import select
|
||||
from oslo_db.sqlalchemy import utils
|
||||
from oslo_db import exception as oslo_db_exception
|
||||
from oslo_db.sqlalchemy.migration_cli import manager
|
||||
from oslo_log import log
|
||||
|
||||
from designate.i18n import _
|
||||
from designate.i18n import _LW
|
||||
from designate import exceptions
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
def get_migration_manager(repo_path, url, init_version=None):
|
||||
|
@ -14,9 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
from oslo_log import log
|
||||
import oslo_messaging as messaging
|
||||
from mock import call
|
||||
from mock import Mock
|
||||
@ -32,7 +32,7 @@ from designate.tests.test_pool_manager import PoolManagerTestCase
|
||||
from designate.tests.test_pool_manager import POOL_DICT
|
||||
import designate.pool_manager.service as pm_module
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class PoolManagerServiceNoopTest(PoolManagerTestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user