---
title: "Discussion on \"Remove all console.log() from your project in less than a minute\" | Hashnode"
description: "Discussion on \"Remove all console.log() from your project in less than a minute\". Removing all console.log() from your project before production can be very difficult, Here is how to remove all console.log() from your project in 1 minute"
url: "https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Remove all console.log() from your project in less than a minute](https://suhailkakar.com/remove-all-consolelog-from-your-project-in-less-than-a-minute?utm_source=hashnode&utm_medium=feed)

Removing all console.log() from your project before production can be very difficult, Here is how to remove all console.log() from your project in 1 minute

Aug 22, 2021 · 1 min read · suhailkakar.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#general-advice](https://hashnode.com/tag/general-advice)

## Written by

[Suhail Kakar](https://hashnode.com/@suhailkakar)

@suhailkakar · Afghanistan → India

  
[View profile](https://hashnode.com/@suhailkakar)

DevRel Engineer @ Livepeer

Suhail is a software developer specializing in full-stack web and mobile application development. He is interested in contributing to open source and building Web3 applications.

## Responses 6

Markdown supported · ⌘↵ to post

[ona Bri](https://hashnode.com/@briona)

[Sep 6, 2022](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/631763ad2cef8b07c2f1d048)

Did you think this was the best way to see a completely different space? Game [slope unblocked](https://slopeunblocked.co/) is a straightforward game to play. You'll use arrowhead strategies to dodge obstacles and change gravity to avoid hitting the red walls or sliding in the void.

[Bob Jones](https://hashnode.com/@crazy4groovy)

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

Hm, what happens with multi-line logs?

[Suhail Kakar](https://hashnode.com/@suhailkakar)

[Aug 30, 2021](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/612cd3d8fd0bf8636d76ff7a#reply-612cd6082858872661b9daf7)

For multiple lines, you need to use

```
console\.log\(([^)]+)\);
```

[Aiyush Gupta](https://hashnode.com/@Aiyush)

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

Awesome article 😎

[Suhail Kakar](https://hashnode.com/@suhailkakar)

[Aug 23, 2021](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/6123556eb115357df05f11c7#reply-61235639b115357df05f11ee)

Thank you Aiyush :)

[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.

[Idris Olubisi](https://hashnode.com/@olanetsoft)

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

Thanks for sharing the awesome tips

[Suhail Kakar](https://hashnode.com/@suhailkakar)

[Aug 23, 2021](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/6122cf13e404793819cab894#reply-61230b15a5d08237f40e2eba)

Thank you Idris, Glad you liked it :)

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

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

Nice. Thanks for sharing

[Suhail Kakar](https://hashnode.com/@suhailkakar)

[Aug 22, 2021](https://hashnode.com/posts/remove-all-consolelog-from-your-project-in-less-than-a-minute/6121fc30e404793819caa6ea/comment/61222bd8a5d08237f40e1c47#reply-61222e13a5d08237f40e1cb5)

Thanks Yogesh, Glad you liked it :)
