MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / simpleFormatter

Function simpleFormatter

test/jest-config.ts:17–41  ·  view source on GitHub ↗
(type: LogType, ...message: LogMessage[])

Source from the content-addressed store, hash-verified

15const REVERSED_RED = '\u001b[91;7m';
16const BLUE = '\u001b[34;1m';
17// const BRIGHT_BLUE = '\u001b[94;1m';
18const YELLOW = '\u001b[33;0m';
19// const DIM_YELLOW = '\u001b[33;2m';
20
21// const GREY_BG = '\u001b[40;1m';
22
23function simpleFormatter(type: LogType, ...message: LogMessage[]): string {
24 const CONSOLE_INDENT = ' ';
25
26 let s = message.map((x) => x.toString()).join('');
27
28 if (type === 'assert')
29 s =
30 '\n' +
31 REVERSED_RED +
32 ' ASSERTION FAILURE ' +
33 RESET +
34 RED +
35 ' ' +
36 message +
37 RESET;
38 else if (type === 'error')
39 s = REVERSED_RED + ' ERROR ' + RESET + RED + ' ' + message + RESET;
40 else if (type === 'log') s = BLUE + message + RESET;
41 else if (type === 'warn') s = YELLOW + 'WARNING ' + YELLOW + message + RESET;
42
43 if (!process.stderr.isTTY || process.env.NO_COLOR !== undefined)
44 s = stripVTControlCharacters(s);

Callers

nothing calls this directly

Calls 2

mapMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected