MCPcopy Create free account
hub / github.com/code-pushup/cli / #log

Method #log

packages/utils/src/lib/logger.ts:478–496  ·  view source on GitHub ↗
(message: string, color?: AnsiColors, options?: LogOptions)

Source from the content-addressed store, hash-verified

476 }
477
478 #log(message: string, color?: AnsiColors, options?: LogOptions): void {
479 const print: (text: string) => void = options?.noLineBreak
480 ? text => process.stdout.write(text)
481 : console.log;
482
483 if (this.#activeSpinner) {
484 if (this.#activeSpinner.isSpinning) {
485 this.#activeSpinnerLogs.push(this.#format(message, color));
486 } else {
487 const indented =
488 options?.noIndent || !message ? message : indentLines(message, 2);
489 print(this.#format(indented, color));
490 }
491 } else {
492 print(this.#format(message, color));
493 }
494 this.#endsWithBlankLine =
495 (!message || message.endsWith('\n')) && !options?.noIndent;
496 }
497
498 #format(message: string, color: AnsiColors | undefined): string {
499 if (!this.#groupColor || this.#activeSpinner?.isSpinning) {

Callers 6

errorMethod · 0.95
warnMethod · 0.95
infoMethod · 0.95
debugMethod · 0.95
newlineMethod · 0.95
#spinnerMethod · 0.95

Calls 2

#formatMethod · 0.95
indentLinesFunction · 0.85

Tested by

no test coverage detected