Bug: [BUG] Crashes on undefined if maskValuesRegEx option specified
See original GitHub issueDescribe the bug
Crashes on undefined
if maskValuesRegEx
option specified
To Reproduce
import { Logger } from 'tslog';
const logger = new Logger({ maskValuesRegEx: [/bearer \S+/] });
logger.info(undefined);
Expected behavior
Log empty value same as in case without maskValuesRegEx
.
Screenshots
> node dist/cli
./node_modules/tslog/dist/cjs/BaseLogger.js:181
source = source.replace(regEx, this.settings.maskPlaceholder);
^
TypeError: Cannot read properties of undefined (reading 'replace')
at ./node_modules/tslog/dist/cjs/BaseLogger.js:181:53
at Array.forEach (<anonymous>)
at ./node_modules/tslog/dist/cjs/BaseLogger.js:180:65
at Logger._recursiveCloneAndMaskValuesOfKeys (./node_modules/tslog/dist/cjs/BaseLogger.js:184:31)
at ./node_modules/tslog/dist/cjs/BaseLogger.js:154:25
at Array.map (<anonymous>)
at Logger._mask (./node_modules/tslog/dist/cjs/BaseLogger.js:153:22)
at Logger.log (./node_modules/tslog/dist/cjs/BaseLogger.js:96:24)
at Logger.info (./node_modules/tslog/dist/cjs/index.js:23:22)
at Object.<anonymous> (./src/cli.ts:35:8)
Additional context Add any other context about the problem here.
Node.js Version Node.js v18.12.1
OS incl. Version macOS 13.1 (22C65)
Issue Analytics
- State:
- Created 9 months ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Boris Gorbylev ekho - GitHub
Describe the bug Crashes on undefined if maskValuesRegEx option specified To Reproduce import { Logger } from 'tslog'; const logger = new Logger({...
Read more >React App crashes giving as useState input give an undefined ...
Variables transactionName , setTransactionName , amount and setAmount are not declared. You can either use const or let to declare them.
Read more >Fix "Aw, Snap!" page crashes and other page loading errors
Fix "Aw, Snap!" page crashes and other page loading errors. If you're getting the "Aw, Snap" error or another error code instead of...
Read more >Troubleshoot Router Crashes - Cisco
Follow these links to troubleshoot the specific type of crash your router experiences: Abort · Address Error · Bus Error · Cache Error...
Read more >Diagnosing and resolving bugs in your running app
Inspect your running app to isolate bugs, locate crashes, identify excess system resource usage, visualize memory bugs, and investigate view layout problems ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
V4.6.0 is out that fixes this and adds more tests.
V4.4.6 is out now 👍