Skip to content

Commit 84bcbef

Browse files
Merge pull request #1253 from opencomponents/simplify-log-parameter-names
[INTERNAL] Simplify log parameter names for newline
2 parents 38dc51a + e77400b commit 84bcbef

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, noNewLine?: boolean) => void;
26-
log: (msg: string, noNewLine?: boolean) => void;
27-
ok: (msg: string, noNewLine?: boolean) => void;
28-
warn: (msg: string, noNewLine?: 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, noNewLine?: boolean) => log(msg, 'red', !noNewLine),
33-
log: (msg: string, noNewLine?: boolean) => log(msg, null, !noNewLine),
34-
ok: (msg: string, noNewLine?: boolean) => log(msg, 'green', !noNewLine),
35-
warn: (msg: string, noNewLine?: boolean) => log(msg, 'yellow', !noNewLine)
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)