Chromium Code Reviews| Index: build/android/adb_logcat_printer.py |
| diff --git a/build/android/adb_logcat_printer.py b/build/android/adb_logcat_printer.py |
| index 55176ab9201333745d63f878bcdcb68118efe95a..30f3136d00cd03f97388db3e47320140a795668e 100755 |
| --- a/build/android/adb_logcat_printer.py |
| +++ b/build/android/adb_logcat_printer.py |
| @@ -159,10 +159,6 @@ def main(argv): |
| if len(args) != 1: |
| parser.error('Wrong number of unparsed args') |
| base_dir = args[0] |
| - if options.output_path: |
| - output_file = open(options.output_path, 'w') |
| - else: |
| - output_file = sys.stdout |
| log_stringio = cStringIO.StringIO() |
| logger = logging.getLogger('LogcatPrinter') |
| @@ -172,6 +168,19 @@ def main(argv): |
| ' %(message)s')) |
| logger.addHandler(sh) |
| + if options.output_path: |
| + if not os.path.exists(os.path.dirname(options.output_path)): |
| + logger.warning('Output dir %s doesn\'t exist. Creating it.', |
| + os.path.dirname(options.output_path)) |
| + os.makedirs(os.path.dirname(options.output_path)) |
| + output_file = open(options.output_path, 'w') |
| + logger.info('Dumping logcat to local file %s. If running in a build, ' |
| + 'this file will likely will be uploaded to google storage ' |
| + 'in a proceeding step. It can be downloaded from there.', |
|
jbudorick
2016/03/25 17:25:19
nit: s/proceeding/later/
|
| + options.output_path) |
| + else: |
| + output_file = sys.stdout |
| + |
| try: |
| # Wait at least 5 seconds after base_dir is created before printing. |
| # |