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

Function appendToLogFile

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

Write the provided text to the log file, prepending each line with the log level.

(logLevel: LogLevel | undefined, ...text: unknown[])

Source from the content-addressed store, hash-verified

175
176/** Write the provided text to the log file, prepending each line with the log level. */
177function appendToLogFile(logLevel: LogLevel | undefined, ...text: unknown[]) {
178 if (logStream === undefined) {
179 return;
180 }
181 if (logLevel === undefined) {
182 logStream.write(text.join(' ') + '\n');
183 return;
184 }
185
186 const logLevelText = `${LogLevel[logLevel]}:`.padEnd(LOG_LEVEL_COLUMNS);
187 logStream.write(
188 stripVTControlCharacters(
189 text
190 .join(' ')
191 .split('\n')
192 .map((l) => `${logLevelText} ${l}\n`)
193 .join(''),
194 ),
195 );
196}

Callers 2

runConsoleCommandFunction · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected