Skip to content

Commit

Permalink
Merge pull request #7872 from appium/isaac-default
Browse files Browse the repository at this point in the history
Fix formatting of default capabilities
  • Loading branch information
imurchie committed Feb 15, 2017
2 parents b57d1a3 + 0142e5a commit 859fe1d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion lib/main.js
Expand Up @@ -48,9 +48,32 @@ function logDeprecationWarning (deprecatedArgs) {
}

function logNonDefaultArgsWarning (args) {
// cleanly print out the default arguments, allowing for prefix and timestamp
function getValueArray (obj, indent = ' ') {
if (!_.isObject(obj)) {
return [obj];
}

let strArr = ['{'];
for (let [arg, value] of _.toPairs(obj)) {
if (!_.isObject(value)) {
strArr.push(`${indent} ${arg}: ${value}`);
} else {
value = getValueArray(value, `${indent} `);
strArr.push(`${indent} ${arg}: ${value.shift()}`);
strArr.push(...value);
}
}
strArr.push(`${indent}}`);
return strArr;
}
logger.info('Non-default server args:');
for (let [arg, value] of _.toPairs(args)) {
logger.info(` ${arg}: ${util.inspect(value)}`);
value = getValueArray(value);
logger.info(` ${arg}: ${value.shift()}`);
for (let val of value) {
logger.info(val);
}
}
}

Expand Down

0 comments on commit 859fe1d

Please sign in to comment.