Closed ydemetriades closed 4 years ago
Can this PR be merged, or more reviewers are required?
@nblumhardt can you please review this PR? Thanks!
Thanks for the PR! Couple of questions-
[LogMasked]
? Seems like this is closely related to that feature, so either integrating regex in there, or modelling the API of this one on the existing feature might help keep the use experience cohesiveGood questions!
Imagine a scenario where you have a Session string which consists of some public and some sensitive information and separated by a character (eg. | ). Let's take an example like this:
Public1|Sensitive2|Public3
. So, I would like to log the 2 public ones but not the sensitive one.
I thought about integrating the regex functionality into LogMaskedAttribute
but that would add properties and logic in that attribute. I think it's better to keep LogMaskedAttribute
as simple as possible and introduce the LogRegexAttribute
which has a single purpose!
@nblumhardt bump
Thanks for the nudge, @ydemetriades - super busy week!
I like the feature; I am still processing where this fits in; I think the naming is probably the main thing - wondering if we can come up with something that's a verb phrase like the other attributes (e.g. NotLogged
-> "not logged", LogMasked
-> "log masked") - maybe LogReplaced
or LogReplacement
?
Or perhaps we could tie it to LogMasked
with a name like LogMaskedPattern
? Still thinking :-)
I also wonder whether the default pattern/replacement are useful, since this would essentially be covered by LogMasked
. Perhaps requiring the pattern and replacement as constructor parameters would resolve this? E.g.:
[LogReplacement("secret(thing)", "***$1")]
Hey @nblumhardt! Good points!
Read your comment! Totally agree with you!
I think LogReplaced
fits better with the rest attributes
Also, yes default values are unnecessary! So we can force them with constructor parameters! So should I proceed to the necessary changes with this one?
[LogReplaced("secret(thing)", "***$1")]
Sounds good! 👍
I have changed the Attribute as we have discussed! Let's review it again! 😀
@nblumhardt I have pushed your PR suggestions! 😁
Great, thanks!
Thank you @nblumhardt! And @sungam3r as well!
Introduced
LogRegexAttribute
This functionality now allows you to define and apply regex operations.