diff options
author | bpastene <bpastene@chromium.org> | 2016-03-25 12:30:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 19:31:34 +0000 |
commit | 0c5d30d1932954a34d417bf1f195ac1428d5aeed (patch) | |
tree | 1d2c0bb4c32d53b20d35b25a20ef04679813d520 /build | |
parent | 0ea257e12a4baf25b4e7f451f56db98dc91c9c6b (diff) | |
download | chromium_src-0c5d30d1932954a34d417bf1f195ac1428d5aeed.zip chromium_src-0c5d30d1932954a34d417bf1f195ac1428d5aeed.tar.gz chromium_src-0c5d30d1932954a34d417bf1f195ac1428d5aeed.tar.bz2 |
Create output dir in logcat printer if it doesn't exist.
Also add a statement about where to find the actual logcat.
BUG=597771,448050
Review URL: https://codereview.chromium.org/1838483002
Cr-Commit-Position: refs/heads/master@{#383330}
Diffstat (limited to 'build')
-rwxr-xr-x | build/android/adb_logcat_printer.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/build/android/adb_logcat_printer.py b/build/android/adb_logcat_printer.py index 55176ab..a715170 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 later step. It can be downloaded from there.', + options.output_path) + else: + output_file = sys.stdout + try: # Wait at least 5 seconds after base_dir is created before printing. # |