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:
MODIFY
heatclient/_i18n.py
heatclient/_i18n.py
@@ -28,16 +28,6 @@ _translators = oslo_i18n.TranslatorFactory(domain='heatclient')
# 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 get_available_languages():
return oslo_i18n.get_available_languages('heatclient')

MODIFY
heatclient/common/hook_utils.py
heatclient/common/hook_utils.py
@@ -15,7 +15,6 @@ import logging
from oslo_utils import fnmatch
from heatclient._i18n import _
-from heatclient._i18n import _LE
from heatclient import exc
logger = logging.getLogger(__name__)
@@ -29,8 +28,8 @@ def clear_hook(hc, stack_id, resource_name, hook_type):
data={'unset_hook': hook_type})
except exc.HTTPNotFound:
logger.error(
- _LE("Stack %(stack)s or resource %(resource)s "
- "not found for hook %(hook_type)"),
+ "Stack %(stack)s or resource %(resource)s "
+ "not found for hook %(hook_type)",
{'resource': resource_name, 'stack': stack_id,
'hook_type': hook_type})

MODIFY
heatclient/common/http.py
heatclient/common/http.py
@@ -28,7 +28,6 @@ import six
from six.moves.urllib import parse
from heatclient._i18n import _
-from heatclient._i18n import _LW
from heatclient.common import utils
from heatclient import exc
@@ -67,7 +66,7 @@ def get_system_ca_file():
if os.path.exists(ca):
LOG.debug("Using ca file %s", ca)
return ca
- LOG.warning(_LW("System ca file could not be found."))
+ LOG.warning("System ca file could not be found.")
class HTTPClient(object):

MODIFY
heatclient/common/utils.py
heatclient/common/utils.py
@@ -29,7 +29,6 @@ from six.moves.urllib import request
import yaml
from heatclient._i18n import _
-from heatclient._i18n import _LE
from heatclient import exc
LOG = logging.getLogger(__name__)
@@ -444,7 +443,7 @@ def get_response_body(resp):
try:
body = resp.json()
except ValueError:
- LOG.error(_LE('Could not decode response body as JSON'))
+ LOG.error('Could not decode response body as JSON')
else:
body = None
return body

MODIFY
heatclient/osc/v1/stack.py
heatclient/osc/v1/stack.py
@@ -24,7 +24,6 @@ import six
from six.moves.urllib import request
from heatclient._i18n import _
-from heatclient._i18n import _LI
from heatclient.common import event_utils
from heatclient.common import format_utils
from heatclient.common import hook_utils
@@ -689,16 +688,16 @@ class DeleteStack(command.Command):
_("Are you sure you want to delete this stack(s) [y/N]? "))
prompt_response = sys.stdin.readline().lower()
if not prompt_response.startswith('y'):
- self.log.info(_LI('User did not confirm stack delete so '
- 'taking no action.'))
+ self.log.info('User did not confirm stack delete so '
+ 'taking no action.')
return
except KeyboardInterrupt: # ctrl-c
- self.log.info(_LI('User did not confirm stack delete '
- '(ctrl-c) so taking no action.'))
+ self.log.info('User did not confirm stack delete '
+ '(ctrl-c) so taking no action.')
return
except EOFError: # ctrl-d
- self.log.info(_LI('User did not confirm stack delete '
- '(ctrl-d) so taking no action.'))
+ self.log.info('User did not confirm stack delete '
+ '(ctrl-d) so taking no action.')
return
failure_count = 0

MODIFY
heatclient/v1/shell.py
heatclient/v1/shell.py
@@ -23,8 +23,6 @@ from six.moves.urllib import request
import yaml
from heatclient._i18n import _
-from heatclient._i18n import _LI
-from heatclient._i18n import _LW
from heatclient.common import deployment_utils
from heatclient.common import event_utils
from heatclient.common import hook_utils
@@ -38,8 +36,8 @@ logger = logging.getLogger(__name__)
def show_deprecated(deprecated, recommended):
- logger.warning(_LW('"%(old)s" is deprecated, '
- 'please use "%(new)s" instead'),
+ logger.warning('"%(old)s" is deprecated, '
+ 'please use "%(new)s" instead',
{'old': deprecated,
'new': recommended}
)
@@ -105,8 +103,8 @@ def do_stack_create(hc, args):
env_paths=args.environment_file, env_list_tracker=env_files_list)
if args.create_timeout:
- logger.warning(_LW('%(arg1)s is deprecated, '
- 'please use %(arg2)s instead'),
+ logger.warning('%(arg1)s is deprecated, '
+ 'please use %(arg2)s instead',
{
'arg1': '-c/--create-timeout',
'arg2': '-t/--timeout'})
@@ -192,8 +190,8 @@ def do_stack_adopt(hc, args):
raise exc.CommandError('Invalid adopt-file, no data!')
if args.create_timeout:
- logger.warning(_LW('%(arg1)s is deprecated, '
- 'please use %(arg2)s instead'),
+ logger.warning('%(arg1)s is deprecated, '
+ 'please use %(arg2)s instead',
{
'arg1': '-c/--create-timeout',
'arg2': '-t/--timeout'})
@@ -308,16 +306,16 @@ def do_stack_delete(hc, args):
_("Are you sure you want to delete this stack(s) [y/N]? "))
prompt_response = sys.stdin.readline().lower()
if not prompt_response.startswith('y'):
- logger.info(_LI(
- 'User did not confirm stack delete so taking no action.'))
+ logger.info(
+ 'User did not confirm stack delete so taking no action.')
return
except KeyboardInterrupt: # ctrl-c
- logger.info(_LI(
- 'User did not confirm stack delete (ctrl-c) so taking no action.'))
+ logger.info(
+ 'User did not confirm stack delete (ctrl-c) so taking no action.')
return
except EOFError: # ctrl-d
- logger.info(_LI(
- 'User did not confirm stack delete (ctrl-d) so taking no action.'))
+ logger.info(
+ 'User did not confirm stack delete (ctrl-d) so taking no action.')
return
for sid in args.id:

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: I601eee9f1fca65d5fb53e6b75482b74283908a29