import { gray , green , yellow , red } from "chalk" ; import { CliError } from "./CliError" ; let verbose = false ; export const setVerbose = ( value ) => { verbose = value ; } ; export const log = { verbose : ( message ) => { if ( verbose ) { console . log ( gray ( message ) ) ; } } , info : ( message ) => console . log ( message ) , success : ( message ) => console . log ( green ( message ) ) , warn : ( message ) => console . log ( yellow ( `WARNING: ${ message }` ) ) , error : ( message ) => console . log ( red ( `ERROR: ${ message }` ) ) , } ; export const logAndExit = ( error ) => { const message = error instanceof CliError ? error . message : error . stack || error . message ; log . error ( message ) ; process . exit ( 1 ) ; } ;