chrome.experimental.devtools.console
API
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
chrome.experimental.devtools.console
API
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.
API reference: chrome.experimental.devtools.console
Methods
addMessage
chrome.experimental.devtools.console.addMessage(Severity
severity, string
text)
Adds a message to the console.
Parameters
-
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 function
The callback parameter should specify a function
that looks like this:
function(array of ConsoleMessage messages) {...};
-
messages
- Console messages.
Events
onMessageAdded
chrome.experimental.devtools.console.onMessageAdded.addListener(function(ConsoleMessage message) {...});
Fired when a new message is added to the console.
Types
ConsoleMessage
(
object
)
A console message.
-
severity
- Message severity.
-
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
number
)
- The number of the line where the message originated, if available.
Severity
(
object
)
Undocumented.
-
Tip
(
string
)
-
Undocumented.
-
Debug
(
string
)
-
Undocumented.
-
Log
(
string
)
-
Undocumented.
-
Warning
(
string
)
-
Undocumented.
-
Error
(
string
)
-
Undocumented.