Chromium Code Reviews| Index: build/android/pylib/logcat_monitor_using_logdog.py |
| diff --git a/build/android/pylib/logcat_monitor_using_logdog.py b/build/android/pylib/logcat_monitor_using_logdog.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8f72b81780f7eaa15f5a0de6649f0a06671b7a27 |
| --- /dev/null |
| +++ b/build/android/pylib/logcat_monitor_using_logdog.py |
| @@ -0,0 +1,34 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
|
jbudorick
2016/11/18 02:31:42
nit: put this in a new pylib/android directory, pl
BigBossZhiling
2016/11/22 02:54:37
Done.
|
| +# 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 |
| + |
| +CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname( |
| + os.path.dirname(os.path.abspath(__file__))))) |
| +sys.path = ([os.path.join(CHROMIUM_SRC_DIR, 'tools', 'swarming_client')] + |
|
jbudorick
2016/11/18 02:31:42
This shold be:
from pylib import constants
s
BigBossZhiling
2016/11/22 02:54:37
Done.
|
| + sys.path) |
|
mikecase (-- gone --)
2016/11/05 01:27:53
Im guessing that is because you are adding this to
BigBossZhiling
2016/11/22 02:54:37
Acknowledged.
|
| + |
| +from devil.android import logcat_monitor |
| +from libs.logdog import bootstrap |
| + |
| +class LogcatMonitorUsingLogdog(logcat_monitor.LogcatMonitor): |
| + def __init__(self, adb, stream_name): |
| + super(LogcatMonitorUsingLogdog, self).__init__(adb) |
| + self.stream_name = stream_name |
| + self.logcat_url = '' |
| + def GetLogcatURL(self): |
|
jbudorick
2016/11/18 02:31:42
Line breaks between methods + docstrings for publi
BigBossZhiling
2016/11/22 02:54:37
Done.
|
| + return self.logcat_url |
| + def Stop(self): |
|
jbudorick
2016/11/18 02:31:42
Can we implement this s.t. we write to the logdog
BigBossZhiling
2016/11/22 02:54:37
Done.
|
| + super(LogcatMonitorUsingLogdog, self).Stop() |
| + try: |
| + stream_client = bootstrap.ButlerBootstrap.probe().stream_client() |
| + this_stream = stream_client.open_text(self.stream_name) |
| + with open(self._record_file.name, 'r') as f: |
| + this_stream.write(f.readline()) |
| + this_stream.close() |
| + self.logcat_url = stream_client.get_viewer_url(self.stream_name) |
| + except bootstrap.NotBootstrappedError: |
| + logging.exception('Error not bootstrapped. Failed to start logdog') |