Skip to content

Commit e59f2c7

Browse files
committed
tweak output
1 parent 80f162a commit e59f2c7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/helpers/logger.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
import * as nodeConsole from 'console';
22
import * as nodeUtil from 'util';
33
import chalk from 'chalk';
4+
import redent from 'redent';
45

56
export const logger = {
67
debug(message: any, ...args: any[]) {
7-
const output = nodeUtil.format('RNTL: ', message, ...args);
8+
const output = formatMessage('●', message, ...args);
89
nodeConsole.debug(chalk.dim(output));
910
},
1011

1112
info(message: any, ...args: any[]) {
12-
const output = nodeUtil.format('RNTL: ', message, ...args);
13+
const output = formatMessage('●', message, ...args);
1314
nodeConsole.info(output);
1415
},
1516

1617
warn(message: any, ...args: any[]) {
17-
const output = nodeUtil.format('RNTL: ', message, ...args);
18+
const output = formatMessage('▲', message, ...args);
1819
nodeConsole.warn(chalk.yellow(output));
1920
},
2021

2122
error(message: any, ...args: any[]) {
22-
const output = nodeUtil.format('RNTL: ', message, ...args);
23+
const output = formatMessage('■', message, ...args);
2324
nodeConsole.error(chalk.red(output));
2425
},
2526
};
27+
28+
function formatMessage(symbol: string, message: any, ...args: any[]) {
29+
const formatted = nodeUtil.format(message, ...args);
30+
const indented = redent(formatted, 4);
31+
return ` ${symbol} ${indented.trimStart()}\n`;
32+
}

0 commit comments

Comments
 (0)