---
title: "Comment by Anup K Tarafder on \"Remove all console.log() from your project in less than a minute\" | Hashnode"
description: "There is a problem with this approach. Let&#39;s say somehow there is a problem in your production. But you can&#39;t reproduce that in your dev environment. A"
url: "https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/612310e7a5d08237f40e2efb"
---

[Discussion](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea)

Comment [Remove all console.log() from your project in less than a minute](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea)

[Anup K Tarafder](https://hashnode.com/@aktarafder)

[Aug 23, 2021](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/612310e7a5d08237f40e2efb)

There is a problem with this approach. Let's say somehow there is a problem in your production. But you can't reproduce that in your dev environment. A simpler way to not show console.log() output is to assign an empty function in your index/main JS file. I work with angular mainly. So, inside the main.ts file, I check which env it is and assign the empty function if it's a prod build.

```
console.log = () => {};
```

This way your console.log remains in your code but does nothing. If you want to debug, just do the following in the windows' devtool.

```
console.log = console.info
```

It will print the logs correctly.
