whatwg / console

Console Standard
https://console.spec.whatwg.org/
Other
269 stars 67 forks source link

Feature request: Ability to switch on and off particular log type -> console.(INFO,WARN,ERROR,TRACE etc) #202

Open crealityeducation opened 2 years ago

crealityeducation commented 2 years ago

If my project has console.(INFO,WARN,ERROR,TRACE etc) log type and accordingly placed in the js library. for DEV purpose I would like to have INFO enabled but in prod I dont want INFO logs. There is a way to handle it with GV INFO = true/false and the INFO && console.info(xxx). But I don't like this way of writing code. Is there any way to set console.info=true/false which will make the specific type of logs visible?

Thanks, Atul Ingale

domfarolino commented 2 years ago

I think the usual methods of turning off console logs in production are typically done at a level above this specification, and that seems pretty reasonable to me. There have been somewhat-related proposals like https://github.com/whatwg/console/issues/175, but there didn't seem to be too much appetite for this.

Given that, I'm tempted to close this unless implementers want to weigh in /cc @nchevobbe @JosephPecoraro.