Search code examples
angularrouterconsole.log

how to stop angular router events from printing on console


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


Solution

  • 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 -