summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2
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/network/v2
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/network/v2')
-rw-r--r--openstackclient/network/v2/address_scope.py11
-rw-r--r--openstackclient/network/v2/port.py6
2 files changed, 11 insertions, 6 deletions
diff --git a/openstackclient/network/v2/address_scope.py b/openstackclient/network/v2/address_scope.py
index bc1a96c3..6cd13f8c 100644
--- a/openstackclient/network/v2/address_scope.py
+++ b/openstackclient/network/v2/address_scope.py
@@ -13,6 +13,8 @@
"""Address scope action implementations"""
+import logging
+
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
@@ -21,6 +23,9 @@ from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
+LOG = logging.getLogger(__name__)
+
+
def _get_columns(item):
columns = list(item.keys())
if 'tenant_id' in columns:
@@ -122,9 +127,9 @@ class DeleteAddressScope(command.Command):
client.delete_address_scope(obj)
except Exception as e:
result += 1
- self.app.log.error(_("Failed to delete address scope with "
- "name or ID '%(scope)s': %(e)s")
- % {'scope': scope, 'e': e})
+ LOG.error(_("Failed to delete address scope with "
+ "name or ID '%(scope)s': %(e)s"),
+ {'scope': scope, 'e': e})
if result > 0:
total = len(parsed_args.address_scope)
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index 1c5db706..57461f89 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -293,9 +293,9 @@ class DeletePort(command.Command):
client.delete_port(obj)
except Exception as e:
result += 1
- self.app.log.error(_("Failed to delete port with "
- "name or ID '%(port)s': %(e)s")
- % {'port': port, 'e': e})
+ LOG.error(_("Failed to delete port with "
+ "name or ID '%(port)s': %(e)s"),
+ {'port': port, 'e': e})
if result > 0:
total = len(parsed_args.port)