summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2/service.py
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-06-16 20:01:15 +0800
committerSteve Martinelli <s.martinelli@gmail.com>2016-06-20 15:16:51 +0000
commit047cb6849354f4fdf8d365bd109a0ed56a77d200 (patch)
treedc7372f6e90946e82606c2f1a1d974bd02879201 /openstackclient/compute/v2/service.py
parentba825a4d5c04e2e6fd8a82ebbfb2f71a85e683aa (diff)
downloadpython-openstackclient-047cb6849354f4fdf8d365bd109a0ed56a77d200.tar.gz
Standardize logger usage
Use file logger for all command specific logs. This patch also fixes some usage that doesn't follow rules in: http://docs.openstack.org/developer/oslo.i18n/guidelines.html After this patch, all self.log and self.app.log will be standardized to LOG(). NOTE: In shell.py, we got the log in class OpenStackShell, which is also known as self.app.log in other classes. This logger is used to record non-command-specific logs. So we leave it as-is. Change-Id: I114f73ee6c7e84593d71e724bc1ad00d343c1896 Implements: blueprint log-usage
Diffstat (limited to 'openstackclient/compute/v2/service.py')
-rw-r--r--openstackclient/compute/v2/service.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/openstackclient/compute/v2/service.py b/openstackclient/compute/v2/service.py
index d10af2ca..36917e20 100644
--- a/openstackclient/compute/v2/service.py
+++ b/openstackclient/compute/v2/service.py
@@ -15,6 +15,8 @@
"""Service action implementations"""
+import logging
+
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
@@ -23,6 +25,9 @@ from openstackclient.i18n import _
from openstackclient.i18n import _LE
+LOG = logging.getLogger(__name__)
+
+
class DeleteService(command.Command):
"""Delete service command"""
@@ -171,7 +176,7 @@ class SetService(command.Command):
cs.disable(parsed_args.host, parsed_args.service)
except Exception:
status = "enabled" if enabled else "disabled"
- self.log.error(_LE("Failed to set service status to %s"), status)
+ LOG.error(_LE("Failed to set service status to %s"), status)
result += 1
force_down = None
@@ -185,7 +190,7 @@ class SetService(command.Command):
force_down=force_down)
except Exception:
state = "down" if force_down else "up"
- self.log.error(_LE("Failed to set service state to %s"), state)
+ LOG.error(_LE("Failed to set service state to %s"), state)
result += 1
if result > 0: