4 ms·
Often logging backends have a sampling rate to take care of this for you. As it is almost certainly better to setup a buffer in your logging layer and deal wit
by taeric 1y ago
Often logging backends have a sampling rate to take care of this for you. As it is almost certainly better to setup a buffer in your logging layer and deal with this there, than to try and do this everywhere in your code.
- DougN7 1y agoExcept that you waste CPU cycles preparing the log string and calling the log function only to have it all thrown away.
- pvorb 1y agoAt least in the Java world it is common to let the logging framework handle parameter evaluation for you.
- jdbernard 1y agoThis feels like one of those "not obvious until you've seen it in production" requirements: any production-ready logging framework should have a mechanism to delay parameter evaluation until after the threshold/destination checks are performed. Most languages have some version of deferred execution (lazy evaluation, thunks, etc.)