Difference between revisions of "Console API"
m (Added categories)
m (Added category)
|Line 83:||Line 83:|
Revision as of 16:57, 21 November 2013
Firebug adds a global variable named "console" to all web pages loaded in Firefox. This object contains many methods that allow you to write to the Firebug console to expose information that is flowing through your scripts.
- 1 Commands
- 1.1 console.log(object[, object, ...])
- 1.2 console.debug(object[, object, ...])
- 1.3 console.info(object[, object, ...])
- 1.4 console.warn(object[, object, ...])
- 1.5 console.error(object[, object, ...])
- 1.6 console.assert(expression[, object, ...])
- 1.7 console.clear()
- 1.8 console.dir(object)
- 1.9 console.dirxml(node)
- 1.10 console.trace()
- 1.11 console.group(object[, object, ...])
- 1.12 console.groupCollapsed(object[, object, ...])
- 1.13 console.groupEnd()
- 1.14 console.time(name)
- 1.15 console.timeEnd(name)
- 1.16 console.timeStamp(name)
- 1.17 console.profile([title])
- 1.18 console.profileEnd()
- 1.19 console.count([title])
- 1.20 console.exception(error-object[, object, ...])
- 1.21 console.table(data[, columns])
- 2 Implementation Notes
- 3 Note
- 4 See also
Writes a message to the console. You may pass as many arguments as you'd like, and they will be joined together in a space-delimited line.
Writes a message to the console, including a hyperlink to the line where it was called.
Writes a message to the console with the visual "info" icon and color coding and a hyperlink to the line where it was called.
Writes a message to the console with the visual "warning" icon and color coding and a hyperlink to the line where it was called.
Writes a message to the console with the visual "error" icon and color coding and a hyperlink to the line where it was called.
Tests that an expression is true. If not, it will write a message to the console and throw an exception.
Clears the console.
Prints an interactive listing of all properties of the object. This looks identical to the view that you would see in the DOM Panel.
The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function. You can click each function to take you to its source in the Script tab, and click each argument value to inspect it in the DOM or HTML Panel.
Writes a message to the console and opens a nested block to indent all future messages sent to the console. Call
console.groupEnd() to close the block.
console.group(), but the block is initially collapsed.
Closes the most recently opened block created by a call to
Creates a new timer under the given name. Call
console.timeEnd() with the same name to stop the timer and print the time elapsed.
Stops a timer created by a call to
console.time(name) and writes the time elapsed.
Creates a time stamp, which can be used together with HTTP traffic timing to measure when a certain piece of code was executed.
Writes the number of times that the line of code where
count was called was executed.
Allows to log provided data using tabular layout.
consoleis an object attached to the
windowobject in the web page.
- If the page already contains a
consolevariable, it is not overwritten by Firebug's Console API.
- In Firebug Lite, the console is attached as soon as Lite is installed into the page.
The console API formerly implemented a
console.firebug property. This property was removed from the API in Firebug 1.9.0 in order to prevent sites from detecting whether a user has Firebug installed.