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

Side by Side Diff: build/android/pylib/utils/run_tests_helper.py

Issue 18612014: [Android] Log to stdout instead of stderr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Helper functions common to native, java and python test runners.""" 5 """Helper functions common to native, java and python test runners."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import sys
9 import time 10 import time
10 11
11 12
12 class CustomFormatter(logging.Formatter): 13 class CustomFormatter(logging.Formatter):
13 """Custom log formatter.""" 14 """Custom log formatter."""
14 15
15 #override 16 #override
16 def __init__(self, fmt='%(threadName)-4s %(message)s'): 17 def __init__(self, fmt='%(threadName)-4s %(message)s'):
17 # Can't use super() because in older Python versions logging.Formatter does 18 # Can't use super() because in older Python versions logging.Formatter does
18 # not inherit from object. 19 # not inherit from object.
(...skipping 21 matching lines...) Expand all
40 41
41 def SetLogLevel(verbose_count): 42 def SetLogLevel(verbose_count):
42 """Sets log level as |verbose_count|.""" 43 """Sets log level as |verbose_count|."""
43 log_level = logging.WARNING # Default. 44 log_level = logging.WARNING # Default.
44 if verbose_count == 1: 45 if verbose_count == 1:
45 log_level = logging.INFO 46 log_level = logging.INFO
46 elif verbose_count >= 2: 47 elif verbose_count >= 2:
47 log_level = logging.DEBUG 48 log_level = logging.DEBUG
48 logger = logging.getLogger() 49 logger = logging.getLogger()
49 logger.setLevel(log_level) 50 logger.setLevel(log_level)
50 custom_handler = logging.StreamHandler() 51 custom_handler = logging.StreamHandler(sys.stdout)
51 custom_handler.setFormatter(CustomFormatter()) 52 custom_handler.setFormatter(CustomFormatter())
52 logging.getLogger().addHandler(custom_handler) 53 logging.getLogger().addHandler(custom_handler)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698