JSteunou / webstomp-client

Stomp client over websocket for browsers
Apache License 2.0
299 stars 59 forks source link

Custom logs with frame object as the 2nd param #55

Closed zatziky closed 7 years ago

zatziky commented 7 years ago

Hi there,

this is a kind of a feature request. I am aware that it's possible to override the logs via client.debug = (log) => ...myLogic. It is cumbersome to do anything with the plain text. You could send the text and, as the 2nd parameter, the frame object. Then we developers can strip headers, shorten some access tokens, etc. ...

At the moment the debug methods accepts a vararg ...args. Every method in src/client.js is using only 1 arg (the message). See the code:

debug(...args) {
        if (this.hasDebug) console.log(...args);
}

I will create a PR in a moment so that you can verify it will make no harm, you'll see.

zatziky commented 7 years ago

Here is the promised PR - https://github.com/JSteunou/webstomp-client/pull/56

zatziky commented 7 years ago

Hey @JSteunou, what is your opinion?

JSteunou commented 7 years ago

If I understand well you just need more info in the log like the content of a frame. I could do that, but not the way you did in your PR.

zatziky commented 7 years ago

@JSteunou I need to customize the data that is logged and the text is not the best fit. Of course, I don't mind if you do it in a different way.

JSteunou commented 7 years ago

Could you test #58 and tell me if it matches your need?

zatziky commented 7 years ago

@JSteunou Right in the morning I'll check it!