log.mjs
1 import { formatBold, formatError, formatGray } from './format.mjs'; 2 3 export function logInfo(message) { 4 console.log(formatGray(message)); 5 } 6 7 /** 8 * Log an error to the console with an error `message` and optional `remedy` 9 * @param error in the format { message: string, remedy?: string } 10 * @returns void 11 */ 12 export function logError(error) { 13 console.error(); 14 console.error(formatError(error?.message || error)); 15 if (error?.remedy) { 16 console.error(); 17 console.error(formatBold('Suggested remedy:')); 18 console.error(error.remedy); 19 } 20 console.error(); 21 }