Disabling console logs in angular

Viewed 59

I have lot of console.log in my angular project and I want these console.log in development as they are useful for debugging but I don't want to print them in production. I have two ideas to disable console.log in production, first is to create a service and override the console.log function and second idea is to override console.log function in main.ts file.

This is how I am overriding the console.log function

console.log = function (): void { }

I am beginner so I don't have an idea which one should I go with both looks good to me. If there is any other better way to disable console.log I would love to know that too.

Thank you.

0 Answers
Related