Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 2x 2x 1x 2x 1x | import { COLORS } from './colors';
/**
* Print error message in the terminal.
* @param payload message payload
* @param title message title
*/
const printSuccess = <T>(payload: T, title = 'Success') =>
process.stdout.write(`\n ✅ ${COLORS.GREEN}${title}${COLORS.DEFAULT}:\n${payload}\n`);
/**
* Print info message in the terminal.
* @param payload message payload
* @param title message title
*/
const printInfo = <T>(payload: T, title = 'Info') => process.stdout.write(`\n 💬 ${COLORS.YELLOW}${title}${COLORS.DEFAULT}:\n${payload}\n`);
/**
* Print error message in the terminal.
* @param payload message payload
* @param title message title
*/
const printError = <T>(payload: Error & T, title = 'Error') =>
process.stdout.write(`\n ❌ ${COLORS.RED}${title}${COLORS.DEFAULT}:\n${payload.stack}\n`);
export const logger = {
printSuccess,
printInfo,
printError,
};
|