The Console object provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided.

Documentation console by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Static methods

@:value({ condition : false })staticassert (condition:Bool = false, data:Rest<Dynamic>):Void

Log a message and stack trace to console if the first argument is false.

staticclear ():Void

Clear the console.

@:value({ label : "default" })staticcount (label:String = "default"):Void

Log the number of times this line has been called with the given label.

@:value({ label : "default" })staticcountReset (label:String = "default"):Void

Resets the value of the counter with the given label.

staticdebug (data:Rest<Dynamic>):Void

Outputs a message to the console with the log level "debug". Note: Starting with Chromium 58 this method only appears in Chromium browser consoles when level "Verbose" is selected.

staticdir (data:Rest<Dynamic>):Void

Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects.

staticdirxml (data:Rest<Dynamic>):Void

Displays an XML/HTML Element representation of the specified object if possible or the JavaScript Object view if it is not possible.

staticerror (data:Rest<Dynamic>):Void

Outputs an error message. You may use string substitution and additional arguments with this method.

staticexception (data:Rest<Dynamic>):Void

An alias for error().

staticgroup (data:Rest<Dynamic>):Void

Creates a new inline group, indenting all following output by another level. To move back out a level, call groupEnd().

staticgroupCollapsed (data:Rest<Dynamic>):Void

Creates a new inline group, indenting all following output by another level. However, unlike group() this starts with the inline group collapsed requiring the use of a disclosure button to expand it. To move back out a level, call groupEnd().

staticgroupEnd ():Void

Exits the current inline group.

staticinfo (data:Rest<Dynamic>):Void

Informative logging of information. You may use string substitution and additional arguments with this method.

staticlog (data:Rest<Dynamic>):Void

For general output of logging information. You may use string substitution and additional arguments with this method.

staticprofile (data:Rest<Dynamic>):Void

Starts the browser's built-in profiler (for example, the Firefox performance tool). You can specify an optional name for the profile.

staticprofileEnd (data:Rest<Dynamic>):Void

Stops the profiler. You can see the resulting profile in the browser's performance tool (for example, the Firefox performance tool).

statictable (data:Rest<Dynamic>):Void

Displays tabular data as a table.

@:value({ label : "default" })statictime (label:String = "default"):Void

Starts a timer with a name specified as an input parameter. Up to 10,000 simultaneous timers can run on a given page.

@:value({ label : "default" })statictimeEnd (label:String = "default"):Void

Stops the specified timer and logs the elapsed time in seconds since it started.

@:value({ label : "default" })statictimeLog (label:String = "default", data:Rest<Dynamic>):Void

Logs the value of the specified timer to the console.

statictimeStamp (?data:Dynamic):Void

Adds a marker to the browser's Timeline or Waterfall tool.

statictrace (data:Rest<Dynamic>):Void

Outputs a stack trace.

staticwarn (data:Rest<Dynamic>):Void

Outputs a warning message. You may use string substitution and additional arguments with this method.