Created
March 28, 2015 00:08
-
-
Save jasonLaster/2bad4dc4262a22b94c44 to your computer and use it in GitHub Desktop.
monitoring the inspector backend class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dispatch = InspectorBackendClass.Connection.prototype.dispatch; | |
InspectorBackendClass.Connection.prototype.dispatch = function() { | |
if (arguments && arguments.length > 0) { | |
var message = arguments[0]; | |
var object = message ? JSON.parse(message) : {}; | |
console.log.apply(console,['events', object]); | |
} | |
dispatch.apply(this, arguments); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jasonLaster et al.. two things:
native
dumpInspectorProtocolMessages
Instead of using this logging snippet, you can set
InspectorBackendClass.Options.dumpInspectorProtocolMessages = true
to log all messages to the console. It will log theJSON.stringify
'd messages.IMO, stringified is a bit messy, so I have a patch to clean it up and match this logging snippet's output: https://codereview.chromium.org/1606303003.
Updated protocol logging snippet:
As mentioned above, the snippet at the top of the gist is broken. I've evolved what @talitore did above and also instrumented the
sendMessage
method, which is key.This is worth using until https://codereview.chromium.org/1606303003 has landed.
cheers
updated again in july 2016.