File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 88
99import { ɵConsole } from '@angular/core' ;
1010
11+ /**
12+ * A set of log messages that should be ignored and not printed to the console.
13+ */
14+ const IGNORED_LOGS = new Set ( [ 'Angular is running in development mode.' ] ) ;
15+
1116/**
1217 * Custom implementation of the Angular Console service that filters out specific log messages.
1318 *
1419 * This class extends the internal Angular `ɵConsole` class to provide customized logging behavior.
1520 * It overrides the `log` method to suppress logs that match certain predefined messages.
1621 */
1722export class Console extends ɵConsole {
18- /**
19- * A set of log messages that should be ignored and not printed to the console.
20- */
21- private readonly ignoredLogs = new Set ( [ 'Angular is running in development mode.' ] ) ;
22-
2323 /**
2424 * Logs a message to the console if it is not in the set of ignored messages.
2525 *
2626 * @param message - The message to log to the console.
2727 *
2828 * This method overrides the `log` method of the `ɵConsole` class. It checks if the
29- * message is in the `ignoredLogs ` set. If it is not, it delegates the logging to
29+ * message is in the `IGNORED_LOGS ` set. If it is not, it delegates the logging to
3030 * the parent class's `log` method. Otherwise, the message is suppressed.
3131 */
3232 override log ( message : string ) : void {
33- if ( ! this . ignoredLogs . has ( message ) ) {
33+ if ( ! IGNORED_LOGS . has ( message ) ) {
3434 super . log ( message ) ;
3535 }
3636 }
Original file line number Diff line number Diff line change @@ -410,7 +410,11 @@ export async function getRoutesFromAngularRouterConfig(
410410 useValue : { document, url : `${ protocol } //${ host } /` } ,
411411 } ,
412412 {
413+ // An Angular Console Provider that does not print a set of predefined logs.
413414 provide : ɵConsole ,
415+ // Using `useClass` would necessitate decorating `Console` with `@Injectable`,
416+ // which would require switching from `ts_library` to `ng_module`. This change
417+ // would also necessitate various patches of `@angular/bazel` to support ESM.
414418 useFactory : ( ) => new Console ( ) ,
415419 } ,
416420 ] ) ;
You can’t perform that action at this time.
0 commit comments