diff options
| author | Tang Chen <chen.tang@easystack.cn> | 2016-06-07 14:29:41 +0800 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2016-06-14 16:37:57 -0500 |
| commit | 0e9862be7af9a88c9c0e6a9ef4e11e48a1192727 (patch) | |
| tree | a1f0e2683955167a734cf0203987fb03cd964f60 /openstackclient/volume/v1 | |
| parent | 769baf329e6aa619e7d9a5e48a5230bcf4399228 (diff) | |
| download | python-openstackclient-0e9862be7af9a88c9c0e6a9ef4e11e48a1192727.tar.gz | |
Standardize logger usage in volume
self.app.log is the logger in class OpenStackShell,
which should be used to record logs that have nothing
to do with any specific command.
So, use the file logger instead.
This patch also fixes some usage that doesn't follow
rules in:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html
1. add variables to logger as an argument
2. do not wrap variables with str()
Change-Id: I248861a38a4de0412a080046aa7a6f6473c3e082
Implements: blueprint log-usage
Diffstat (limited to 'openstackclient/volume/v1')
| -rw-r--r-- | openstackclient/volume/v1/volume.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py index 7a3bfb97..e11aa1a7 100644 --- a/openstackclient/volume/v1/volume.py +++ b/openstackclient/volume/v1/volume.py @@ -16,6 +16,7 @@ """Volume v1 Volume action implementations""" import argparse +import logging from osc_lib.cli import parseractions from osc_lib.command import command @@ -25,6 +26,9 @@ import six from openstackclient.i18n import _ +LOG = logging.getLogger(__name__) + + class CreateVolume(command.ShowOne): """Create new volume""" @@ -343,13 +347,12 @@ class SetVolume(command.Command): if parsed_args.size: if volume.status != 'available': - self.app.log.error(_("Volume is in %s state, it must be " - "available before size can be extended") % - volume.status) + LOG.error(_("Volume is in %s state, it must be available " + "before size can be extended"), volume.status) return if parsed_args.size <= volume.size: - self.app.log.error(_("New size must be greater than %s GB") % - volume.size) + LOG.error(_("New size must be greater than %s GB"), + volume.size) return volume_client.volumes.extend(volume.id, parsed_args.size) |
