Build an instance of a logging function for the provided level.
( loadCommand: () => Function, level: LogLevel, defaultColor: ((text: string) => string) | null, )
| 58 | |
| 59 | /** Build an instance of a logging function for the provided level. */ |
| 60 | function buildLogLevelFunction( |
| 61 | loadCommand: () => Function, |
| 62 | level: LogLevel, |
| 63 | defaultColor: ((text: string) => string) | null, |
| 64 | ) { |
| 65 | /** Write to stdout for the LOG_LEVEL. */ |
| 66 | return (...values: unknown[]) => { |
| 67 | runConsoleCommand( |
| 68 | loadCommand, |
| 69 | level, |
| 70 | // For string values, apply the default color. |
| 71 | ...values.map((v) => (typeof v === 'string' && defaultColor ? defaultColor(v) : v)), |
| 72 | ); |
| 73 | }; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Run the console command provided, if the environments logging level greater than the |
no test coverage detected