libs/nx/src/executors/shared/logger.ts
Properties |
error | |
Type |
function
|
hasErrors | |
Type |
function
|
info | |
Type |
function
|
success | |
Type |
function
|
warn | |
Type |
function
|
import chalk from 'chalk';
export interface ExecutorLogger {
info: (message: string) => void;
error: (message: string) => void;
success: (message: string) => void;
warn: (message: string) => void;
hasErrors: () => boolean;
}
export function createLogger(): ExecutorLogger {
let hasError = false;
return {
info: (message: string) => console.info(message),
error: (message: string) => {
hasError = true;
console.error(chalk.red(message));
},
success: (message: string) => console.info(chalk.green(message)),
warn: (message: string) => console.warn(chalk.yellow(message)),
hasErrors: () => hasError
};
}