Is the argument to $$$TRACE() always computed, or only when tracing is on?
We have some ObjectScript code in a custom business process:
When Log Trace Events is ticked on the business process in the Production view in the management portal, the argument is obviously computed.
Our question is whether the argument is computed when Log Trace Events is not ticked? Don't want to accidentally include something in a $$$TRACE() statement that takes enough computation to make a performance difference when released to production, even though the final output is not written to the event log.
A more general question is whether its possible to check the Log Trace Events status from ObjectScript, so you could do something like:
(Which is presumably what the $$$TRACE macro is doing under the surface...)
From Ensemble.inc:
#define TRACE(%arg) $$$catTRACE("user",%arg) #define sysTRACE(%arg) $$$catTRACE("system",%arg) #define catTRACE(%cat,%arg) Do:$$$DoTrace ##class(Ens.Util.Trace).WriteTrace(%cat,$$$CurrentClass,$$$CurrentMethod,%arg) #; #define DoTrace $S($D($$$EnsJobLocal("DoTrace")):$$$EnsJobLocal("DoTrace"),1:##class(Ens.Util.Trace).DoTrace()) #; #define EnsJobLocal %Ensemble #; . . . . Class Ens.Util.Trace [ Abstract, ClassType = "", ProcedureBlock, System = 4 ] { ClassMethod DoTrace() { Set tJobConfigName=$$$JobConfigName Quit $G($$$ConfigTrace(tJobConfigName),0)||(""'=$G($$$JobTraceDevice))||$$$IsTerminalDevice($IO) }
Which means that Colin guessed the code right and no, trace is not computed when tracing is off :)
I was going to respond and say something like, "I'm sure that does answer the question, but I'm not sure I understand the answer!" So thanks for the executive summary! And thanks @Robert Cemper
for the background information.