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

Side by Side Diff: build/android/pylib/local/device/local_device_environment.py

Issue 2163833003: Logdog for logcats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update chromium.android.json Created 4 years, 4 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import datetime 5 import datetime
6 import fileinput
6 import functools 7 import functools
7 import logging 8 import logging
8 import os 9 import os
9 import shutil 10 import shutil
10 import tempfile 11 import tempfile
11 import threading 12 import threading
13 import sys
12 14
13 from devil import base_error 15 from devil import base_error
14 from devil.android import device_blacklist 16 from devil.android import device_blacklist
15 from devil.android import device_errors 17 from devil.android import device_errors
16 from devil.android import device_list 18 from devil.android import device_list
17 from devil.android import device_utils 19 from devil.android import device_utils
18 from devil.android import logcat_monitor 20 from devil.android import logcat_monitor
19 from devil.utils import file_utils 21 from devil.utils import file_utils
20 from devil.utils import parallelizer 22 from devil.utils import parallelizer
21 from pylib import constants 23 from pylib import constants
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 with open(cache_path, 'w') as f: 183 with open(cache_path, 'w') as f:
182 f.write(d.DumpCacheData()) 184 f.write(d.DumpCacheData())
183 logging.info('Wrote device cache: %s', cache_path) 185 logging.info('Wrote device cache: %s', cache_path)
184 186
185 self.parallel_devices.pMap(tear_down_device) 187 self.parallel_devices.pMap(tear_down_device)
186 188
187 for m in self._logcat_monitors: 189 for m in self._logcat_monitors:
188 try: 190 try:
189 m.Stop() 191 m.Stop()
190 m.Close() 192 m.Close()
193 for line in fileinput.input([m.output_file], inplace=True):
194 sys.stdout.write('Device(%s) %s' % (m.adb.GetDeviceSerial(), line))
jbudorick 2016/08/10 00:54:39 Why is this writing all logcat to stdout?
nicholaslin 2016/08/10 16:40:35 Changed.
191 except base_error.BaseError: 195 except base_error.BaseError:
192 logging.exception('Failed to stop logcat monitor for %s', 196 logging.exception('Failed to stop logcat monitor for %s',
193 m.adb.GetDeviceSerial()) 197 m.adb.GetDeviceSerial())
194 198
195 if self._logcat_output_file: 199 if self._logcat_output_file:
196 file_utils.MergeFiles( 200 file_utils.MergeFiles(
197 self._logcat_output_file, 201 self._logcat_output_file,
198 [m.output_file for m in self._logcat_monitors]) 202 [m.output_file for m in self._logcat_monitors])
199 shutil.rmtree(self._logcat_output_dir) 203 shutil.rmtree(self._logcat_output_dir)
200 204
201 def BlacklistDevice(self, device, reason='local_device_failure'): 205 def BlacklistDevice(self, device, reason='local_device_failure'):
202 device_serial = device.adb.GetDeviceSerial() 206 device_serial = device.adb.GetDeviceSerial()
203 if self._blacklist: 207 if self._blacklist:
204 self._blacklist.Extend([device_serial], reason=reason) 208 self._blacklist.Extend([device_serial], reason=reason)
205 with self._devices_lock: 209 with self._devices_lock:
206 self._devices = [d for d in self._devices if str(d) != device_serial] 210 self._devices = [d for d in self._devices if str(d) != device_serial]
207 211
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698