MCPcopy Create free account
hub / github.com/angular/dev-infra / buildLogLevelFunction

Function buildLogLevelFunction

ng-dev/utils/logging.ts:60–74  ·  view source on GitHub ↗

Build an instance of a logging function for the provided level.

(
  loadCommand: () => Function,
  level: LogLevel,
  defaultColor: ((text: string) => string) | null,
)

Source from the content-addressed store, hash-verified

58
59/** Build an instance of a logging function for the provided level. */
60function 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

Callers 1

logging.tsFile · 0.85

Calls 1

runConsoleCommandFunction · 0.85

Tested by

no test coverage detected