Rewrite actually modify the source object
See original GitHub issueThe rewriters actually modify the source meta object:
winston.rewriters.push(function(level, msg, meta) {
const actionType = meta && meta.data && meta.data.action;
const valueToHide = meta && meta.data && meta.data.text;
if (actionType === 'typeText' && valueToHide) {
console.log('Logs filtering:', actionType, valueToHide)
meta.data.text = null;
}
return meta;
})
It should be cloned before being passed to the rewriter function.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Modifying a copy of a JavaScript object is causing the original ...
A normal copy. When you change the original object's properties, the copied object's properties will change too (and vice versa). const a =...
Read more >Modify series in the object storage via bucket rewrite tool
This is the example command to delete some data in the specified TSDB block from your object store bucket. For example, if k8s_app_metric37 ......
Read more >ASTRewrite (Eclipse JDT API Specification) - IBM
Converts all modifications recorded by this rewriter into an object representing the the corresponding text edits to the source of a ITypeRoot from...
Read more >Refactor vs. rewrite: Deciding what to do with problem software
A rewrite allows new developers to instantly implement code they are comfortable with. This advantage is especially attractive after a merger or ...
Read more >7.6 Git Tools - Rewriting History
Changing your most recent commit is probably the most common rewriting of history that you'll do. You'll often want to do two basic...
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 FreeTop 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
Top GitHub Comments
And this is detrimental to actual apps. Simple call to
winston.log('Hello', myBusinessObject)
will modify the business object. There should at least be a warning about this behavior.This is a major issue of data integrity compromised by calling a log function.
@lasryaric this is by design. @jcready is correct when he says:
As to your comment about “
winston
is a fancyconsole.log
” @netoneko, I would point out thatconsole.log
does not have rewrite functionality built into it.