Feature Request: Case insensitive alternative to maskAnyRegEx?
Right now maskAnyRegEx is case sensitive by default. Since all strings supplied in the array are joined with a pipe (|) it's not possible to supply a /i global flag (a /g global flag is hardcoded).
So if you set the following: maskAnyRegEx: ["pass.*"], it will not catch this string dbPassword.
That's fairly understandable and you can always use maskValuesOfKeys but I feel like the feature would be a lot safer if either:
- all maskAnyRegEx values defaulted to use both
gandiflags so matches are both global and case insensitive. - a different option is added (something like
maskAnyRegExCaseInsensitive) that explicitly supports case insensitivity by default so thatmaskAnyRegExCaseInsensitive: ["pass.*"]will now catchPASSWORD,dbPassword, orpAsSwOrD.
Here's the regex tester showing these values with the case insensitive turned on: https://regex101.com/r/GQJbo9/1
Thanks for considering it, I'm really enjoying tslog.
Thank you! I will put it on the agenda for V4 and consider it. Have to put in some thoughts, though.
I've been working on a new, completely rewritten version (4.0). This version is way more flexible, and you can basically overwrite all the internal functionality, including this RegEx. Can you give it a go and let me know if that solves your problem?
-
npm i tslog@next -
and run it with
node --enable-source-mapsor for TypeScriptnode --enable-source-maps --experimental-specifier-resolution=node --no-warnings --loader ts-node/esm
Here is an example on how to use it: https://github.com/fullstack-build/tslog/blob/v4/tests/Nodejs/6_json_Settings.test.ts#L124
V4 is released now, so I'm going to close this issue. Feel free to open a new one if V4 didn't solve it for you.
Here are the docs: tslog.js.org