how to stop angular router events from printing on console

Viewed 1731

I am making an angular app and am using the {RouterModule} from @angular/router.

I use the console.log to debug my Application, but since I started using the router module, it has started spamming the console with router events, which makes it hard to see my actual logs.

How can I stop angular router events from printing on console?

Edit 1: Picture of logs

Picture of logs

2 Answers

In your Module search for :

 imports: [
        RouterModule.forRoot(routes,
            // this Debug options:
            { enableTracing: false }
        )
    ]

enableTracing should be false

As shown in the attached screenshot you should need to Enable production mode for your angular application to avoid these logs (As angular application run in development mode by default).

Just put this piece code in your main.ts file before calling bootstrapping of your application -

import {enableProdMode} from '@angular/core';

enableProdMode();
bootstrap(....);

update

Search enableTracing keyword in your routing file, either remove it or set it to false.

{ enableTracing: false }

For more info , refer here -

Related