Skip to content

Commit b565b64

Browse files
rename to keepline
1 parent 1d1bb29 commit b565b64

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/cli/logger.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ const logFns = {
1818
write: (msg: string) => process.stdout.write(msg.toString())
1919
};
2020

21-
const log = (msg: string, color: Color | null, newLine: boolean) =>
22-
logFns[newLine ? 'writeLn' : 'write'](color ? colors[color](msg) : msg);
21+
const log = (msg: string, color: Color | null, keepLine: boolean) =>
22+
logFns[keepLine ? 'write' : 'writeLn'](color ? colors[color](msg) : msg);
2323

2424
export interface Logger {
25-
err: (msg: string, newLine?: boolean) => void;
26-
log: (msg: string, newLine?: boolean) => void;
27-
ok: (msg: string, newLine?: boolean) => void;
28-
warn: (msg: string, newLine?: boolean) => void;
25+
err: (msg: string, keepLine?: boolean) => void;
26+
log: (msg: string, keepLine?: boolean) => void;
27+
ok: (msg: string, keepLine?: boolean) => void;
28+
warn: (msg: string, keepLine?: boolean) => void;
2929
}
3030

3131
const logger: Logger = {
32-
err: (msg: string, newLine = true) => log(msg, 'red', newLine),
33-
log: (msg: string, newLine = true) => log(msg, null, newLine),
34-
ok: (msg: string, newLine = true) => log(msg, 'green', newLine),
35-
warn: (msg: string, newLine = true) => log(msg, 'yellow', newLine)
32+
err: (msg: string, keepLine?: boolean) => log(msg, 'red', !!keepLine),
33+
log: (msg: string, keepLine?: boolean) => log(msg, null, !!keepLine),
34+
ok: (msg: string, keepLine?: boolean) => log(msg, 'green', !!keepLine),
35+
warn: (msg: string, keepLine?: boolean) => log(msg, 'yellow', !!keepLine)
3636
};
3737

3838
export default logger;

0 commit comments

Comments
 (0)