From 047cb6849354f4fdf8d365bd109a0ed56a77d200 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Thu, 16 Jun 2016 20:01:15 +0800 Subject: 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 --- openstackclient/identity/v3/project.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'openstackclient/identity/v3/project.py') diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py index 6145dcf1..4db5bef1 100644 --- a/openstackclient/identity/v3/project.py +++ b/openstackclient/identity/v3/project.py @@ -15,6 +15,8 @@ """Project action implementations""" +import logging + from keystoneauth1 import exceptions as ks_exc from osc_lib.cli import parseractions from osc_lib.command import command @@ -25,6 +27,9 @@ from openstackclient.i18n import _ from openstackclient.identity import common +LOG = logging.getLogger(__name__) + + class CreateProject(command.ShowOne): """Create new project""" @@ -111,7 +116,7 @@ class CreateProject(command.ShowOne): project = utils.find_resource(identity_client.projects, parsed_args.name, domain_id=domain) - self.log.info(_('Returning existing project %s'), project.name) + LOG.info(_('Returning existing project %s'), project.name) else: raise e -- cgit v1.2.1