feat(dev-infra): migrate pullapprove tool to use new logging system (#37422)

Migrate the pullapprove tool in ng-dev to use new logging system rather
than directly calling console.* to create a better experience
for users.

PR Close #37422
This commit is contained in:
Joey Perrott
2020-05-20 14:41:44 -07:00
committed by atscott
parent 47c02efccb
commit 2be1ef6ba0
3 changed files with 35 additions and 28 deletions

View File

@ -5,6 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {error} from '../utils/console';
import {convertConditionToFunction} from './condition_evaluator';
import {PullApproveGroupConfig} from './parse-yaml';
@ -58,9 +60,11 @@ export class PullApproveGroup {
matchedFiles: new Set(),
});
} catch (e) {
console.error(`Could not parse condition in group: ${this.groupName}`);
console.error(` - ${expression}`);
console.error(`Error:`, e.message, e.stack);
error(`Could not parse condition in group: ${this.groupName}`);
error(` - ${expression}`);
error(`Error:`);
error(e.message);
error(e.stack);
process.exit(1);
}
});
@ -84,7 +88,7 @@ export class PullApproveGroup {
`From the [${this.groupName}] group:\n` +
` - ${expression}` +
`\n\n${e.message} ${e.stack}\n\n`;
console.error(errMessage);
error(errMessage);
process.exit(1);
}
});