client .log method mutates payload
tamsingreen opened this issue · 2 comments
Hello, and thanks for open-sourcing this project.
eg here: https://github.com/krakenjs/beaver-logger/blob/master/client/logger.js#L164
Let's say I have an object:
const foo = {
hello: 'world'
};
I want to a) use this object elsewhere (in my case call another method with it) and b) log it. My code is doing this:
this.props.doSomething(foo);
logger.log('info', 'some-event', foo);
doSomething() is making a network request and the object that is sent looks something like:
{"pageID": "ee16011be5", "hello": "world", "timestamp": 1508753799851, "windowID": "584531ba3e"}
As a workaround I can use the spread operator when calling the .log method (ie logger.log('info', 'some-event', {...foo})
) but ideally the log method would take care of this itself.
I will try raise a PR to address this if it's welcome!
Hey!
Is this issue still valid? I couldn't reproduce the bug, there is no log
function.
@SlyBouhafs This has been fixed. Will close. Thank you!