Github user purplecabbage commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/405#discussion_r55602266 --- Diff: cordova-common/src/CordovaLogger.js --- @@ -153,6 +153,30 @@ CordovaLogger.prototype.setLevel = function (logLevel) { }; /** + * Adjusts the current logger level according to the passed options. + * + * @param {Object|Array} opts An object or args array with options + * + * @return {CordovaLogger} Current instance, to allow calls chaining. + */ +CordovaLogger.prototype.adjustLoggerLevel = function (opts) { + if (opts instanceof Array) { + opts.silent = opts.indexOf('--silent') !== -1; --- End diff -- Please do not change the type of the object. Why not go with something concise and easy to understand like : ``` if(Array.isArray(opts)) { if(opts.indexOf('--verbose') > -1) { this.setLevel('verbose'); } else if (opts.indexOf('--silent') > -1) { this.setLevel('error'); } } return this; ``` Note also that I reversed the order of checks in the if/else to reflect that in the original code --verbose out ranks --silent
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org