-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Description
I'd like to develop a feature that could be activated per object, per handler, or (possibly) globally that would:
At the start of a handler, output some limits to the debug log
At the end of a handler, output some limits to the debug log
Of course, it's not a good idea to have this on in Production, as it would slow things down, but it could be a good tool for debugging in sandboxes.
Implementation:
A checkbox on each CMT record
(If global) A new CMT object with key-value pairs (for future scalable feature management) and a record called "ShowLimits" with a value "true."
This is code from an old handler repo I have that I could repurpose here:
if (showLimits) {
System.debug(
LoggingLevel.DEBUG,
String.format(
'{0} on {1} ({2}/{3} queries) and ({4}/{5} DML calls)',
new List<String>{
this.triggerEvent + '',
getHandlerName(),
Limits.getQueries() + '',
Limits.getLimitQueries() + '',
Limits.getDmlStatements() + '',
Limits.getLimitDmlStatements() + ''
}
)
);
Thoughts? Do people think this could be useful?
Metadata
Metadata
Assignees
Labels
No labels