How to change log's level

In case you want to show just some especific information you can change log's level to filter the sensibility of what's shown, this guide has all the respective information.

This can be done in 2 ways:

In runtime

In the browser's console, write:

window.loglevel("LEVEL")

then just press enter.

In compilation time

Step 1

Somewhere in app.component.ts or the environment.ts codes add the next line:

<loglevel>.setLevel("LEVEL")

being loglevel the id of the variable that contains the imported module.

Step 2

import log level from 'loglevel', like this:

import * as loglevel from 'loglevel';

In both cases LEVEL refers to one of the next words:

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • SILENT

Is important to know that the first level contains the other ones and so on.

Notes

  • In both cases you can filter the messages from the developer tools native filter.

  • In case you want to disable the log, just use the SILENT level.

  • In case you want to learn more about loglevel read the README.md from node_modules/loglevel.