|
1 | 1 | import chalk from "chalk" |
2 | | -import { inDebugMode } from "./helpers/is-debug-enabled" |
| 2 | +import { inDebugMode } from "./helpers/in-debug-mode" |
3 | 3 | import { prefixLines } from "./helpers/prefix-lines" |
4 | 4 |
|
5 | 5 | const infoPrefix = chalk.cyan("info ") |
6 | 6 | const debugPrefix = chalk.white("debug ") |
7 | 7 | const warningPrefix = chalk.yellow("warning ") |
8 | 8 | const errorPrefix = chalk.red("error ") |
9 | 9 |
|
10 | | -export const logInfo = (str: string): void => { |
11 | | - console.info(prefixLines(infoPrefix, chalk.white(str))) |
| 10 | +export const logInfo = (...str: string[]): void => { |
| 11 | + console.info(prefixLines(infoPrefix, chalk.white(str.join(" ")))) |
12 | 12 | } |
13 | 13 |
|
14 | | -export const logDebug = (str: string): void => { |
| 14 | +export const logDebug = (...str: string[]): void => { |
15 | 15 | if (inDebugMode()) { |
16 | | - console.debug(prefixLines(debugPrefix, chalk.white(str))) |
| 16 | + console.debug(prefixLines(debugPrefix, chalk.white(str.join(" ")))) |
17 | 17 | } |
18 | 18 | } |
19 | 19 |
|
20 | | -export const logWarning = (str: string): void => { |
21 | | - console.warn(prefixLines(warningPrefix, chalk.yellow(str))) |
| 20 | +export const logWarning = (...str: string[]): void => { |
| 21 | + console.warn(prefixLines(warningPrefix, chalk.yellow(str.join(" ")))) |
22 | 22 | } |
23 | 23 |
|
24 | | -export const logError = (str: string): void => { |
25 | | - console.error(prefixLines(errorPrefix, chalk.red(str))) |
| 24 | +export const logError = (...str: string[]): void => { |
| 25 | + console.error(prefixLines(errorPrefix, chalk.red(str.join(" ")))) |
26 | 26 | } |
0 commit comments