javascriptgoogle-chromegoogle-chrome-devtools

Conditional Logpoint in Chrome Devtools


If there a way to do a conditional logpoint in Chrome Devtools?


Solution

  • There's no way to add a conditional logpoint in Chrome Devtools.

    The workaround is to add a non-breaking conditional breakpoint with console.log:

    foo.bar===123 && console.log('foo!', foo)
    

    The result of this expression is always falsy: either false (for the condition) or undefined (for console.log) so the breakpoint doesn't trigger and only prints the message on condition.