From 6fba34d0cfc3049810f36ca3c5c9e7a09b329c90 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 2 Jun 2011 13:45:12 +0000 Subject: [PATCH] Add input_api.logging. This makes it possible to dump logging information from a PRESUBMIT script when calling git cl presubmit -v -v -v for example. R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/7027031 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@87603 0039d316-1c4b-4281-b951-d872f2087c98 --- presubmit_canned_checks.py | 2 ++ presubmit_support.py | 1 + tests/presubmit_unittest.py | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 2d501b72f..734292519 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -600,6 +600,8 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None): # were listed, try to run pylint. try: from pylint import lint + input_api.logging.debug( + 'Using pylint v%s from %s' % (lint.version, lint.__file__)) except ImportError: if input_api.platform == 'win32': return [output_api.PresubmitNotifyResult( diff --git a/presubmit_support.py b/presubmit_support.py index 9c93ab85a..074403398 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -243,6 +243,7 @@ class InputApi(object): self.cPickle = cPickle self.cStringIO = cStringIO self.json = json + self.logging = logging.getLogger('PRESUBMIT') self.os_listdir = os.listdir self.os_walk = os.walk self.os_path = os.path diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 0d257368c..f07e2fda3 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -793,7 +793,8 @@ class InputApiUnittest(PresubmitTestsBase): 'LocalToDepotPath', 'PresubmitLocalPath', 'ReadFile', 'RightHandSideLines', 'ServerPaths', 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ', - 'host_url', 'is_committing', 'json', 'marshal', 'os_listdir', 'os_walk', + 'host_url', 'is_committing', 'json', 'logging', 'marshal', 'os_listdir', + 'os_walk', 'os_path', 'owners_db', 'pickle', 'platform', 'python_executable', 're', 'rietveld', 'subprocess', 'tbr', 'tempfile', 'time', 'traceback', 'unittest', 'urllib2', 'version', 'verbose',