Problem / Goal
For debugging, most of us often write console.log to enable us to analyze problems.
But, it is might be dangerous because there is a risk of accidentally outputting confidential information (api key, password, etc).
Therefor, we don't want to output console.log in production.
Solution Overview
Override console.log method on a function that does nothing.
(There is also another way that use webpack settings.)
Concrete Steps
Override console.log method on a function that does nothing.
app/main.ts
if (environment.production) {
window.console.log = () => {};
}
Top comments (0)