Remove log translations
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I4e462fd263a9e964595962f967b5a7e5c1a9212a
This commit is contained in:
parent
d59abab2c1
commit
f8ccaa47c0
@ -20,10 +20,6 @@ from paste import deploy
|
||||
from werkzeug import serving
|
||||
|
||||
from vitrage.api import hooks
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LI
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LW
|
||||
from vitrage import service
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -48,8 +44,8 @@ def setup_app(pecan_config=PECAN_CONFIG, conf=None):
|
||||
pecan_debug = conf.api.pecan_debug
|
||||
if conf.api.workers != 1 and pecan_debug:
|
||||
pecan_debug = False
|
||||
LOG.warning(_LW('pecan_debug cannot be enabled, if workers is > 1, '
|
||||
'the value is overridden with False'))
|
||||
LOG.warning('pecan_debug cannot be enabled, if workers is > 1, '
|
||||
'the value is overridden with False')
|
||||
|
||||
app = pecan.make_app(
|
||||
pecan_config['app']['root'],
|
||||
@ -72,7 +68,7 @@ def load_app(conf):
|
||||
|
||||
if not cfg_file:
|
||||
raise cfg.ConfigFilesNotFoundError([conf.api.paste_config])
|
||||
LOG.info(_LI('Full WSGI config used: %s') % cfg_file)
|
||||
LOG.info('Full WSGI config used: %s', cfg_file)
|
||||
return deploy.loadapp("config:" + cfg_file)
|
||||
|
||||
|
||||
@ -81,17 +77,17 @@ def build_server(conf):
|
||||
# Create the WSGI server and start it
|
||||
host, port = conf.api.host, conf.api.port
|
||||
|
||||
LOG.info(_LI('Starting server in PID %s') % os.getpid())
|
||||
LOG.info(_LI('Configuration:'))
|
||||
LOG.info('Starting server in PID %s', os.getpid())
|
||||
LOG.info('Configuration:')
|
||||
conf.log_opt_values(LOG, log.INFO)
|
||||
|
||||
if host == '0.0.0.0':
|
||||
LOG.info(_LI(
|
||||
'serving on 0.0.0.0:%(port)s, view at http://127.0.0.1:%(port)s')
|
||||
% ({'port': port}))
|
||||
LOG.info(
|
||||
'serving on 0.0.0.0:%(port)s, view at http://127.0.0.1:%(port)s',
|
||||
{'port': port})
|
||||
else:
|
||||
LOG.info(_LI('serving on http://%(host)s:%(port)s') % (
|
||||
{'host': host, 'port': port}))
|
||||
LOG.info('serving on http://%(host)s:%(port)s',
|
||||
{'host': host, 'port': port})
|
||||
|
||||
serving.run_simple(host, port,
|
||||
app, processes=conf.api.workers)
|
||||
|
@ -20,8 +20,6 @@ from pecan.core import abort
|
||||
|
||||
from vitrage.api.controllers.rest import RootRestController
|
||||
from vitrage.api.policy import enforce
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LI
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -42,8 +40,7 @@ class AlarmsController(RootRestController):
|
||||
enforce("list alarms", pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
||||
LOG.info(_LI('returns list alarms with vitrage id %s') %
|
||||
vitrage_id)
|
||||
LOG.info('returns list alarms with vitrage id %s', vitrage_id)
|
||||
|
||||
try:
|
||||
return self._get_alarms(vitrage_id, all_tenants)
|
||||
|
@ -19,7 +19,6 @@ from pecan.core import abort
|
||||
|
||||
from vitrage.api.controllers.rest import RootRestController
|
||||
from vitrage.api.policy import enforce
|
||||
from vitrage.i18n import _LI
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -29,7 +28,7 @@ class EventController(RootRestController):
|
||||
|
||||
@pecan.expose('json')
|
||||
def post(self, **kwargs):
|
||||
LOG.info(_LI('Post event called with args: %s') % kwargs)
|
||||
LOG.info('Post event called with args: %s', kwargs)
|
||||
|
||||
enforce("event post", pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
@ -21,9 +21,6 @@ from pecan.core import abort
|
||||
from vitrage.api.controllers.rest import RootRestController
|
||||
from vitrage.api.policy import enforce
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LI
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
@ -42,7 +39,7 @@ class RCAController(RootRestController):
|
||||
enforce('get rca', pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
||||
LOG.info(_LI('received show rca with alarm id %s') % alarm_id)
|
||||
LOG.info('received show rca with alarm id %s', alarm_id)
|
||||
return self.get_rca(alarm_id, all_tenants)
|
||||
|
||||
@staticmethod
|
||||
|
@ -16,8 +16,6 @@ from oslo_log import log
|
||||
from pecan.core import abort
|
||||
from pecan import rest
|
||||
from vitrage.api.policy import enforce
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LI
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -27,7 +25,7 @@ class ResourcesController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, id_, *remainder):
|
||||
LOG.info(_LI('got lookup %s') % id_)
|
||||
LOG.info('got lookup %s', id_)
|
||||
return ResourceController(id_), remainder
|
||||
|
||||
@pecan.expose('json')
|
||||
@ -35,7 +33,7 @@ class ResourcesController(rest.RestController):
|
||||
enforce('list resources', pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
||||
LOG.info(_LI('received list resources with filter %s') % resource_type)
|
||||
LOG.info('received list resources with filter %s', resource_type)
|
||||
|
||||
try:
|
||||
return self.get_resources(resource_type)
|
||||
@ -59,7 +57,7 @@ class ResourceController(rest.RestController):
|
||||
enforce('get resource', pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
||||
LOG.info(_LI('received get resource with id %s') % self.id)
|
||||
LOG.info('received get resource with id %s', self.id)
|
||||
try:
|
||||
return self.get_resource(self.id)
|
||||
except Exception as e:
|
||||
|
@ -19,7 +19,6 @@ from pecan.core import abort
|
||||
|
||||
from vitrage.api.controllers.rest import RootRestController
|
||||
from vitrage.api.policy import enforce
|
||||
from vitrage.i18n import _LI
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -30,7 +29,7 @@ class TemplateController(RootRestController):
|
||||
@pecan.expose('json')
|
||||
def get_all(self):
|
||||
|
||||
LOG.info(_LI('returns template list'))
|
||||
LOG.info('returns template list')
|
||||
|
||||
enforce("template list",
|
||||
pecan.request.headers,
|
||||
@ -45,7 +44,7 @@ class TemplateController(RootRestController):
|
||||
@pecan.expose('json')
|
||||
def get(self, template_uuid):
|
||||
|
||||
LOG.info(_LI('get template content'))
|
||||
LOG.info('get template content')
|
||||
|
||||
enforce("template show",
|
||||
pecan.request.headers,
|
||||
@ -61,7 +60,7 @@ class TemplateController(RootRestController):
|
||||
@pecan.expose('json')
|
||||
def post(self, **kwargs):
|
||||
|
||||
LOG.info(_LI('validate template. args: %s') % kwargs)
|
||||
LOG.info('validate template. args: %s', kwargs)
|
||||
|
||||
enforce("template validate",
|
||||
pecan.request.headers,
|
||||
|
@ -25,7 +25,6 @@ from vitrage.common.constants import VertexProperties as VProps
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.datasources.transformer_base import CLUSTER_ID
|
||||
from vitrage.i18n import _LI
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -42,14 +41,14 @@ class TopologyController(RootRestController):
|
||||
enforce("get topology", pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
||||
LOG.info(_LI('received get topology: depth->%(depth)s '
|
||||
'graph_type->%(graph_type)s root->%(root)s') %
|
||||
LOG.info('received get topology: depth->%(depth)s '
|
||||
'graph_type->%(graph_type)s root->%(root)s',
|
||||
{'depth': depth, 'graph_type': graph_type, 'root': root})
|
||||
|
||||
if query:
|
||||
query = json.loads(query)
|
||||
|
||||
LOG.info(_LI("query is %s") % query)
|
||||
LOG.info("query is %s", query)
|
||||
|
||||
return self.get_graph(graph_type, depth, query, root, all_tenants)
|
||||
|
||||
|
@ -26,11 +26,6 @@ from vitrage.datasources.nagios.properties import NagiosProperties\
|
||||
as NagiosProps
|
||||
from vitrage.datasources.nagios.properties import NagiosTestStatus
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LE
|
||||
# noinspection PyProtectedMember
|
||||
from vitrage.i18n import _LW
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@ -58,11 +53,11 @@ class NagiosDriver(AlarmDriverBase):
|
||||
return []
|
||||
|
||||
if not nagios_password:
|
||||
LOG.warning(_LW('Nagios password is not defined'))
|
||||
LOG.warning('Nagios password is not defined')
|
||||
return []
|
||||
|
||||
if not nagios_url:
|
||||
LOG.warning(_LW('Nagios url is not defined'))
|
||||
LOG.warning('Nagios url is not defined')
|
||||
return []
|
||||
|
||||
session = requests.Session()
|
||||
@ -76,7 +71,7 @@ class NagiosDriver(AlarmDriverBase):
|
||||
nagios_services = NagiosParser().parse(response.text)
|
||||
return nagios_services
|
||||
else:
|
||||
LOG.error(_LE('Failed to get nagios data. Response code: %s') %
|
||||
LOG.error('Failed to get nagios data. Response code: %s',
|
||||
response.status_code)
|
||||
return []
|
||||
|
||||
|
@ -15,7 +15,6 @@ from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.exception import VitrageAlgorithmError
|
||||
from vitrage.graph.filter import check_filter
|
||||
from vitrage.i18n import _LW
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -69,9 +68,8 @@ def subgraph_matching(base_graph, subgraph, matches, validate=False):
|
||||
subgraph,
|
||||
validate)
|
||||
if not initial_sg:
|
||||
LOG.warning(_LW('subgraph_matching:Initial sub-graph creation failed'))
|
||||
LOG.warning(_LW('subgraph_matching: Known matches: %s'),
|
||||
str(matches))
|
||||
LOG.warning('subgraph_matching:Initial sub-graph creation failed')
|
||||
LOG.warning('subgraph_matching: Known matches: %s', str(matches))
|
||||
return final_subgraphs
|
||||
queue = [initial_sg]
|
||||
|
||||
|
@ -25,16 +25,6 @@ _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
|
||||
# Translators for log levels.
|
||||
#
|
||||
# The abbreviated names are meant to reflect the usual use of a short
|
||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
||||
# the level.
|
||||
_LI = _translators.log_info
|
||||
_LW = _translators.log_warning
|
||||
_LE = _translators.log_error
|
||||
_LC = _translators.log_critical
|
||||
|
||||
|
||||
def translate(value, user_locale):
|
||||
return oslo_i18n.translate(value, user_locale)
|
||||
|
Loading…
x
Reference in New Issue
Block a user