Console.log Development vs Production

I was working on a project with some local software house developer and what i notice is they use to much console’s in application and these console are all in from local/development to production which is really bad for the application , so i decided to work on it and make a solution to this, we can create a custom function which will work for use to console data on some specific environment like on local/development but not on production,

i just create a util folder and in it i create a file name utils.js in which i define a function

in this example you can see i just create a function with name “consoleLog” which console the data with string which comes from parameter pass to this function, ignore the env and if condition , now this console will work on every environment and console dat,
but we want to console data only in development

npm i react-dotenv install this library and create .env file on your root folder, and then see the previous logic.

Hi I am Zain Ahmed Software Engineer with passionate about try different technologies and try some cool staff, I create Blogs/Content on different platform.