OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Shutdown adb_logcat_monitor and print accumulated logs. | 7 """Shutdown adb_logcat_monitor and print accumulated logs. |
8 | 8 |
9 To test, call './adb_logcat_printer.py <base_dir>' where | 9 To test, call './adb_logcat_printer.py <base_dir>' where |
10 <base_dir> contains 'adb logcat -v threadtime' files named as | 10 <base_dir> contains 'adb logcat -v threadtime' files named as |
11 logcat_<deviceID>_<sequenceNum> | 11 logcat_<deviceID>_<sequenceNum> |
12 | 12 |
13 The script will print the files to out, and will combine multiple | 13 The script will print the files to out, and will combine multiple |
14 logcats from a single device if there is overlap. | 14 logcats from a single device if there is overlap. |
15 | 15 |
16 Additionally, if a <base_dir>/LOGCAT_MONITOR_PID exists, the script | 16 Additionally, if a <base_dir>/LOGCAT_MONITOR_PID exists, the script |
17 will attempt to terminate the contained PID by sending a SIGINT and | 17 will attempt to terminate the contained PID by sending a SIGINT and |
18 monitoring for the deletion of the aforementioned file. | 18 monitoring for the deletion of the aforementioned file. |
19 """ | 19 """ |
| 20 # pylint: disable=W0702 |
20 | 21 |
21 import cStringIO | 22 import cStringIO |
22 import logging | 23 import logging |
23 import optparse | 24 import optparse |
24 import os | 25 import os |
25 import re | 26 import re |
26 import signal | 27 import signal |
27 import sys | 28 import sys |
28 import time | 29 import time |
29 | 30 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 except: | 204 except: |
204 logger.exception('Unexpected exception') | 205 logger.exception('Unexpected exception') |
205 | 206 |
206 logger.info('Done.') | 207 logger.info('Done.') |
207 sh.flush() | 208 sh.flush() |
208 output_file.write('\nLogcat Printer Event Log\n') | 209 output_file.write('\nLogcat Printer Event Log\n') |
209 output_file.write(log_stringio.getvalue()) | 210 output_file.write(log_stringio.getvalue()) |
210 | 211 |
211 if __name__ == '__main__': | 212 if __name__ == '__main__': |
212 sys.exit(main(sys.argv[1:])) | 213 sys.exit(main(sys.argv[1:])) |
OLD | NEW |