Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1566)

Unified Diff: third_party/upload.py

Issue 221423007: Fix upload.py to properly use a local logger (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « rietveld.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/upload.py
diff --git a/third_party/upload.py b/third_party/upload.py
index 37b1131c461301a8ee6f71768a145cd5e9a16a85..908edc476a4b9e70886f5c5b81547c3c62502f20 100755
--- a/third_party/upload.py
+++ b/third_party/upload.py
@@ -78,6 +78,7 @@ except ImportError:
# 2: Info logs.
# 3: Debug logs.
verbosity = 1
+LOGGER = logging.getLogger('upload')
# The account type used for authentication.
# This line could be changed by the review server (see handler for
@@ -270,9 +271,9 @@ class AbstractRpcServer(object):
self.account_type = account_type
self.opener = self._GetOpener()
if self.host_override:
- logging.info("Server: %s; Host: %s", self.host, self.host_override)
+ LOGGER.info("Server: %s; Host: %s", self.host, self.host_override)
else:
- logging.info("Server: %s", self.host)
+ LOGGER.info("Server: %s", self.host)
def _GetOpener(self):
"""Returns an OpenerDirector for making HTTP requests.
@@ -284,7 +285,7 @@ class AbstractRpcServer(object):
def _CreateRequest(self, url, data=None):
"""Creates a new urllib request."""
- logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
+ LOGGER.debug("Creating request for: '%s' with payload:\n%s", url, data)
req = urllib2.Request(url, data=data, headers={"Accept": "text/plain"})
if self.host_override:
req.add_header("Host", self.host_override)
@@ -931,7 +932,7 @@ def GetRpcServer(server, email=None, host_override=None, save_cookies=True,
if re.match(r'(http://)?localhost([:/]|$)', host):
if email is None:
email = "test@example.com"
- logging.info("Using debug user %s. Override with --email" % email)
+ LOGGER.info("Using debug user %s. Override with --email" % email)
server = HttpRpcServer(
server,
lambda: (email, "password"),
@@ -1017,7 +1018,7 @@ def RunShellWithReturnCodeAndStderr(command, print_output=False,
Returns:
Tuple (stdout, stderr, return code)
"""
- logging.info("Running %s", command)
+ LOGGER.info("Running %s", command)
env = env.copy()
env['LC_MESSAGES'] = 'C'
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
@@ -1279,7 +1280,7 @@ class SubversionVCS(VersionControlSystem):
path = path + "/"
base = urlparse.urlunparse((scheme, netloc, path, params,
query, fragment))
- logging.info("Guessed %sbase = %s", guess, base)
+ LOGGER.info("Guessed %sbase = %s", guess, base)
return base
if required:
ErrorExit("Can't find URL in output from svn info")
@@ -1307,7 +1308,7 @@ class SubversionVCS(VersionControlSystem):
for line in data.splitlines():
if line.startswith("Index:") or line.startswith("Property changes on:"):
count += 1
- logging.info(line)
+ LOGGER.info(line)
if not count:
ErrorExit("No valid patches found in output from svn diff")
return data
@@ -1736,7 +1737,7 @@ class CVSVCS(VersionControlSystem):
for line in data.splitlines():
if line.startswith("Index:"):
count += 1
- logging.info(line)
+ LOGGER.info(line)
if not count:
ErrorExit("No valid patches found in output from cvs diff")
@@ -1798,7 +1799,7 @@ class MercurialVCS(VersionControlSystem):
svndiff.append("Index: %s" % filename)
svndiff.append("=" * 67)
filecount += 1
- logging.info(line)
+ LOGGER.info(line)
else:
svndiff.append(line)
if not filecount:
@@ -2527,9 +2528,9 @@ def RealMain(argv, data=None):
global verbosity
verbosity = options.verbose
if verbosity >= 3:
- logging.getLogger().setLevel(logging.DEBUG)
+ LOGGER.setLevel(logging.DEBUG)
elif verbosity >= 2:
- logging.getLogger().setLevel(logging.INFO)
+ LOGGER.setLevel(logging.INFO)
vcs = GuessVCS(options)
@@ -2547,7 +2548,7 @@ def RealMain(argv, data=None):
if not base and options.download_base:
options.download_base = True
- logging.info("Enabled upload of base file")
+ LOGGER.info("Enabled upload of base file")
if not options.assume_yes:
vcs.CheckForUnknownFiles()
if data is None:
@@ -2579,7 +2580,7 @@ def RealMain(argv, data=None):
b = urlparse.urlparse(base)
username, netloc = urllib.splituser(b.netloc)
if username:
- logging.info("Removed username from base URL")
+ LOGGER.info("Removed username from base URL")
base = urlparse.urlunparse((b.scheme, netloc, b.path, b.params,
b.query, b.fragment))
form_fields.append(("base", base))
« no previous file with comments | « rietveld.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698