Provider logging

This commit is contained in:
Nick Farina
2015-07-16 08:44:04 -07:00
parent 891d4033e8
commit 342a7ccc98
4 changed files with 59 additions and 4 deletions

View File

@@ -83,6 +83,9 @@ class CliProviderSetup {
prompt.start();
prompt.get(this.buildPromptSchema(), (err, result) => {
// add a linebreak after our last prompt
console.log('');
// apply configuration values entered by the user
for (let key:string in result) {
let value:object = result[key];
@@ -103,7 +106,24 @@ class CliProviderSetup {
}
validateProviderConfig() {
this.providerModule.validateConfig();
let currentlyInsideValidateConfigCall = false;
// we allow for the provider's validateConfig to call our callback immediately/synchronously
// from inside validateConfig() itself.
let callback = (err) => {
if (!err) {
log.info(`Setup complete.`);
}
else {
log.error(`Setup failed: ${err.message}`);
}
}
currentlyInsideValidateConfigCall = true;
this.providerModule.validateConfig(callback);
currentlyInsideValidateConfigCall = false;
}
// builds a "schema" obejct for the prompt lib based on the provider's config spec