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

Unified Diff: build/android/pylib/android/logdog_logcat_monitor.py

Issue 2664873002: Add logdog_helper script. (Closed)
Patch Set: Add logdog_helper script. Created 3 years, 11 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
Index: build/android/pylib/android/logdog_logcat_monitor.py
diff --git a/build/android/pylib/android/logdog_logcat_monitor.py b/build/android/pylib/android/logdog_logcat_monitor.py
index 2125e2e7780bcd64ffae019fd82f4e86c03c1629..250bf72d88b801bcf503ec477beb75feb661d8b2 100644
--- a/build/android/pylib/android/logdog_logcat_monitor.py
+++ b/build/android/pylib/android/logdog_logcat_monitor.py
@@ -2,21 +2,16 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import os
import logging
-import sys
from devil.android import logcat_monitor
from devil.utils import reraiser_thread
-from pylib import constants
-
-sys.path.insert(0, os.path.abspath(os.path.join(
- constants.DIR_SOURCE_ROOT, 'tools', 'swarming_client')))
-from libs.logdog import bootstrap # pylint: disable=import-error
+from pylib.utils import logdog_helper
class LogdogLogcatMonitor(logcat_monitor.LogcatMonitor):
"""Logcat monitor that writes logcat to a logdog stream.
- The logdog stream client will return a url, where contains the logcat.
+
+ The logdog stream client will return a url which contains the logcat.
"""
def __init__(self, adb, stream_name, clear=True, filter_specs=None):
super(LogdogLogcatMonitor, self).__init__(adb, clear, filter_specs)
@@ -24,16 +19,7 @@ class LogdogLogcatMonitor(logcat_monitor.LogcatMonitor):
self._logdog_stream = None
self._stream_client = None
self._stream_name = stream_name
- try:
- self._stream_client = bootstrap.ButlerBootstrap.probe().stream_client()
- self._logdog_stream = self._stream_client.open_text(self._stream_name)
- except bootstrap.NotBootstrappedError as e:
- if logging.getLogger().isEnabledFor(logging.DEBUG):
- logging.exception('Unable to enable logdog_logcat: %s.', e)
- except (KeyError, ValueError) as e:
- logging.exception('Error when creating stream_client/stream: %s.', e)
- except Exception as e: # pylint: disable=broad-except
- logging.exception('Unknown Error: %s.', e)
+ self._logdog_stream = logdog_helper.open_text(self._stream_name)
jbudorick 2017/01/31 16:11:53 While I recognize that you're not changing the beh
mikecase (-- gone --) 2017/01/31 23:08:25 Moved opening stream to Start()
def GetLogcatURL(self):
"""Return logcat url.
@@ -50,11 +36,7 @@ class LogdogLogcatMonitor(logcat_monitor.LogcatMonitor):
try:
super(LogdogLogcatMonitor, self)._StopRecording()
if self._logdog_stream:
- try:
- self._logcat_url = self._stream_client.get_viewer_url(
- self._stream_name)
- except (KeyError, ValueError) as e:
- logging.exception('Error cannot get viewer url: %s', e)
+ self._logcat_url = logdog_helper.get_viewer_url(self._stream_name)
self._logdog_stream.close()
except Exception as e: # pylint: disable=broad-except
logging.exception('Unknown Error: %s.', e)
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_result.py » ('j') | build/android/pylib/base/base_test_result.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698