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 | |
21 | 20 |
22 import cStringIO | 21 import cStringIO |
23 import logging | 22 import logging |
24 import optparse | 23 import optparse |
25 import os | 24 import os |
26 import re | 25 import re |
27 import signal | 26 import signal |
28 import sys | 27 import sys |
29 import time | 28 import time |
30 | 29 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 except: | 203 except: |
205 logger.exception('Unexpected exception') | 204 logger.exception('Unexpected exception') |
206 | 205 |
207 logger.info('Done.') | 206 logger.info('Done.') |
208 sh.flush() | 207 sh.flush() |
209 output_file.write('\nLogcat Printer Event Log\n') | 208 output_file.write('\nLogcat Printer Event Log\n') |
210 output_file.write(log_stringio.getvalue()) | 209 output_file.write(log_stringio.getvalue()) |
211 | 210 |
212 if __name__ == '__main__': | 211 if __name__ == '__main__': |
213 sys.exit(main(sys.argv[1:])) | 212 sys.exit(main(sys.argv[1:])) |
OLD | NEW |