Details
-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
Security Level: Public
-
None
-
CBG Sprint 35, CBG Sprint 36
-
5
Description
The current logging/log redaction framework will run the Redactor type conversions (via base.UD()) before any logging even takes place. This adds unnessesary overhead when logging redactable data at levels like Debug/Trace and we don't have those log levels enabled.
There seems to be a small tweak we can make to the log redactor and logging code that would enable us to only do these Redactor conversions when we know we're going to log, and also when we know we have some log redaction enabled.
By changing base.UD() from returning a Redactor type, to returning a RedactorFunc (which in turn returns the Redactor), we can choose whether or not to exectue this function down in the logging layer, based on log-level, and log-redaction settings.
We should benchmark this change before/after for enabled and disabled log levels with enabled and disabled redaction settings to make sure we're not introducing more garbage for the GC as a tradeoff.