If a deployment loglevel is set to `audit` do the ...
# suitescript
c
If a deployment loglevel is set to
audit
do the
log.debug()
statements get executed? Do they cause overhead while loglevel is set to
audit
?
s
It's pretty interesting question, I would think they get executed but just not stored on the db.
e
Yes they get executed and do send a request to the server, the log entry just doesn't get created
so there is significant overhead in them
👏🏻 1
c
This is good to know.
e
So in theory, commenting out log.debug (when not using them) would be more beneficial than changing the log level to something higher than debug?
c
Seems that way.
s
NFT solves this by using a logger that supports log level thresholds. Also, for client scripts the NFT logger logs only to the browser console by default - so no network round trips. Long story short - don't need to comment out logging statements using a better logger. One figures there's good reason those log.debug() were put there in the first place, so why lose them?
e
So in theory, commenting out log.debug (when not using them) would be more beneficial than changing the log level to something higher than debug? (edited)
Yes.
c
Is it possible to look up the current script deployment
loglevel
during execution?
e
^ I like where this is heading
e
Yes, using
N/runtime
c
Well that solves the problem. 🙂
e
Then wrap your log.debugs in an if (loglevel == debug)
👎 2
e
Depending on how many debug logs you actually have, it may just be unnecessary code bloat
c
A general wrapper around
N/log
which caches the setting would work. This applies if you have a large library.
e
Of course, it just may not be necessary; or you could just clone NFT and pull out the logger module (I assume)
Lots of options, as with all problems
s
Yes, the NFT logger is actually Aurelia's logger with a custom appender for logging to the execution log. In short, NFT solves this problem, but developers here like to reinvent things for reasons I don't quite comprehend.
e
That's absolutely not unique to here
but I also do not comprehend
s
agree it's not unique to here, but I see more resistance to using libraries here (NetSuite development) than anywhere else in my (looong) career.