Option to write debug trace selectively

It would be great to be able to optionally disable the automatic saving of debug traces on a particular automation and then re-enable this trace saving while executing a script – a sort of “if the scrpt got here, save the whole trace” command.

For example, I am triggering some scripts on the state on the Sun (i.e. gets triggered every 5 minutes or so), and then rejecting 90% of these triggers using a complex set of conditions, so that some action is effectively permitted to happen only once every hour or so. I would like to look at the trace of the automation that actually begun to run and failed due to some later error, but instead my trace history is filled with triggers rejected because of not passing the main condition.