noodlog icon indicating copy to clipboard operation
noodlog copied to clipboard

extract ObscureSensitiveParams function

Open alessandroargentieri opened this issue 5 years ago • 0 comments

Now you can enable or disable the ObscureSensitiveData functionality whose check is applied to all log records when enabled. It slows down the execution time even when you log a simple record. Extract and make ObscureSensitiveParam public, in order to give the possibility to choose to disable the functionality and using it only when needed. This could be done this way:

log.SetConfig{ &log.Configs{
         ObscureSensitiveData: log.Disable,
         SensitiveParams: []string{"password"},
     }
}

And then:

log.Info(log.ObscureSensitiveData(myrecord))

This way the feature remains disabled by default but used only when needed.

alessandroargentieri avatar Apr 14 '21 13:04 alessandroargentieri