forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsole.ts
37 lines (34 loc) · 1.24 KB
/
console.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { ɵConsole } from '@angular/core';
/**
* A set of log messages that should be ignored and not printed to the console.
*/
const IGNORED_LOGS = new Set(['Angular is running in development mode.']);
/**
* Custom implementation of the Angular Console service that filters out specific log messages.
*
* This class extends the internal Angular `ɵConsole` class to provide customized logging behavior.
* It overrides the `log` method to suppress logs that match certain predefined messages.
*/
export class Console extends ɵConsole {
/**
* Logs a message to the console if it is not in the set of ignored messages.
*
* @param message - The message to log to the console.
*
* This method overrides the `log` method of the `ɵConsole` class. It checks if the
* message is in the `IGNORED_LOGS` set. If it is not, it delegates the logging to
* the parent class's `log` method. Otherwise, the message is suppressed.
*/
override log(message: string): void {
if (!IGNORED_LOGS.has(message)) {
super.log(message);
}
}
}