question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: [Feature] [Question] masking dynamic values, such as regex pattern matching

See original GitHub issue

Description / Use Case for a Feature

I may misunderstand docs and this is already supported, labeled question to clarify it.

There are some cases we would like to traverse all object payload recursively to detect a certain patterns of strings matching regex, such as prefix-based auth token and vice versa. Is there way to specify it via current mask* configuration values?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kwonojcommented, Sep 3, 2020

Awesome, thanks for the help!

0reactions
terehovcommented, Sep 3, 2020

Got it. Technically it was possible already since maskAny did accept RegEx. To make it more obvious I have released a version v2.8.0 that reflects that in the docs as well as the naming of the setting maskAnyRegEx.

Here is an example for your use case:

const secretiveLogger = new Logger({
  name: "SecretiveLogger2",
  maskAnyRegEx: ["token_prefix_[\\w0-9_]*"],
});

secretiveLogger.info({
  x: "token_prefix_123 test1",
  y: "token_prefix_456_789 test2",
  z: "just a test",
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices for Regular Expressions in .NET - Microsoft Learn
You can call a static pattern-matching method, such as Regex.Match(String, String). This method doesn't require instantiation of a regular ...
Read more >
Regular Expressions :: Eloquent JavaScript
In this chapter, I will discuss one such tool, regular expressions. Regular expressions are a way to describe patterns in string data. They...
Read more >
How to do dynamic regex matching, in redshift? - Stack Overflow
Yes. The one you are sugessting is matching a column with a static regex. The question states the matching has to be done...
Read more >
RegExp - JavaScript - MDN Web Docs - Mozilla
Chrome Edge RegExp Full support. Chrome1. Toggle history Full support. Edge12. Toggle history @@match Full support. Chrome50. Toggle history Full support. Edge13. Toggle history @@matchAll Full...
Read more >
Set rules for your form - Google Docs Editors Help
You can require answers to match a particular set of criteria called regular expressions. Regular expressions search for patterns in the answers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found