chrome.experimental.devtools.console
Use chrome.experimental.devtools.console to retrieve messages from
the inspected page console and post messages there. getMessages()
returns the list of messages on the console, onMessageAdded
event provides notifications on new messages, and addMessage()
allows an extension to add new messages.
chrome.experimental.devtools.console reference
Types
ConsoleMessage
A console message.
-
text
(
string
)
-
The text of the console message, as represented by the first argument to the console.log() or a similar method (no parameter substitution performed).
-
url
(
optional
string
)
-
The URL of the script that originated the message, if available.
-
line
(
optional
double
)
-
The number of the line where the message originated, if available.
Methods
addMessage
chrome.experimental.devtools.console.addMessage(
Severity severity,
string text)
Adds a message to the console.
Parameters
-
severity
(
Severity
)
-
The severity of the message.
-
text
(
string
)
-
The text of the message.
getMessages
chrome.experimental.devtools.console.getMessages(function callback)
Retrieves console messages.
Parameters
-
callback
(
function
)
-
A function that receives console messages when the request completes.
Callback
The callback parameter should specify a function
that looks like this:
function(array of ConsoleMessage messages) {...};
Events
onMessageAdded
chrome.experimental.devtools.console.onMessageAdded
.addListener(function(
ConsoleMessage message)
{...});
Fired when a new message is added to the console.
Listener Parameters