Tracing & Logging
Completely remove api.trace()
calls when committing your code, so that it does not get deployed to production.
Also remove excessive calls to api.logInfo()
and api.logWarn()
.
api.trace()
does not cause a significant slowdown, but if the arguments you pass to it are expensive to compute, then you will see a performance decrease nevertheless.
api.logInfo()
, and api.logWarn()
are a bit slower than api
.trace(), and the same principle as above applies to objects that are passed as arguments.
Remove the calls to api.trace()
before committing to Git, or comment it out, and clean up unnecessary calls to api.logInfo()
and api.logWarn()
.
Common Pitfalls
A common pitfall is when api.jsonEncode()
is called within api.trace()
:
Wrong
api.trace("something", api.jsonEncode(xxx), null)
Be mindful of calling api.jsonEncode()
, since it is computationally expensive. Especially when calling from a line item logic.
References:
Â
Found an issue in documentation? Write to us.
Â