MCPcopy
hub / github.com/angular/angular / ConsoleReporter

Class ConsoleReporter

packages/benchpress/src/reporter/console_reporter.ts:21–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 */
20@Injectable()
21export class ConsoleReporter extends Reporter {
22 static PRINT = new InjectionToken('ConsoleReporter.print');
23 static PROVIDERS = [
24 {provide: ConsoleReporter, deps: [COLUMN_WIDTH, SampleDescription, ConsoleReporter.PRINT]},
25 {provide: COLUMN_WIDTH, useValue: defaultColumnWidth},
26 {
27 provide: ConsoleReporter.PRINT,
28 useValue: function (v: any) {
29 // tslint:disable-next-line:no-console
30 console.log(v);
31 },
32 },
33 ];
34
35 private textReporter: TextReporterBase;
36
37 constructor(
38 @Inject(COLUMN_WIDTH) private _columnWidth: number,
39 private _sampleDescription: SampleDescription,
40 @Inject(ConsoleReporter.PRINT) private _print: Function,
41 ) {
42 super();
43 this.textReporter = new TextReporterBase(this._columnWidth, this._sampleDescription);
44 this._print(this.textReporter.description());
45 }
46
47 override reportMeasureValues(measureValues: MeasureValues): Promise<any> {
48 this._print(this.textReporter.sampleMetrics(measureValues));
49 return Promise.resolve(null);
50 }
51
52 override reportSample(
53 _completeSample: MeasureValues[],
54 validSamples: MeasureValues[],
55 ): Promise<any> {
56 this._print(this.textReporter.separator());
57 this._print(this.textReporter.sampleStats(validSamples));
58 return Promise.resolve(null);
59 }
60}

Callers

nothing calls this directly

Calls 1

logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…