disco icon indicating copy to clipboard operation
disco copied to clipboard

console.log only when in dev mode

Open Nacho114 opened this issue 3 years ago • 2 comments

Using console.log can be very slow (similar to how print() in python or other languages console output can create a big overhead). This is important only in the training_manager as there are a lot of console.log. We should do something like:

if (dev mode) console.log('some info')

https://stackoverflow.com/questions/11426185/will-console-log-reduce-javascript-execution-performance

Nacho114 avatar Feb 08 '22 15:02 Nacho114

still an issue now? @s314cy i think you and @tharvik did mention it sometime

martinjaggi avatar Oct 25 '22 15:10 martinjaggi

I think nacho was referring to the calls to console.{log,warn,error} within the web client.

In my view, console prints are necessary in case of an error. This allows the user to receive visual feedback in the client's UI together with a more detailed error in the console, if they're willing to look for it and potentially report it to us. So we should keep them here.

On the other hand, console.log calls should not appear in production code. Right now, most of those calls were removed for the sake of production-readiness. However, it would certainly be useful to have them in the dev environment. Thus I would not consider this issue as closed, but it's definitely not urgent. It can wait for another similar issue to appear and be solved together.

s314cy avatar Nov 07 '22 12:11 s314cy