In our Angular application (with the Angular CLI) we use several operators console
. Is there a global way to detect the environment and then display it console.log
in our components and services only during development?
What do I mean by the global path - I know that we can use something like:
if (!environment.production) {
console.log(this.reviewTasksList);
}
But using this code every time we need console.log
(along with the necessary import to get the variable environment
), our code will become a kind of detailed.
I want to know if there is a way:
- faster access to the environment.
- Perhaps delete all console logs during prod build.
Or is the best solution here to create a registration service and do all the checking of the environment inside it?
, .