Best way to toggle between enabled and disabled console logs?

Scenario: I have a collection with multiple requests and within each request there are numerous console.log lines that write out variable names/values creating a detailed trace of what is going on. With the amount of data I’m looping through and writing out to the console, postman becomes very sluggish (Which I expect given how much is writing out).

What would be the best way to conditionally toggle logging on/off? I like the idea of having all of the logging for trace and troubleshooting purposes, but I don’t want it enabled full time.

The only thing I can think of is set a postman variable e.g. “EnableConsoleLog” and give it a true/false value.

Then within my scripts use an if conditional to check that variable value to determine whether or not my console.log line gets hit or not.

Is there a cleaner or better approach to doing this?