Documentation ¶
Overview ¶
Package console provides GopherJS wrappers for the JavaScript console.
Some functions support format specifiers. The following specifiers are supported:
%s – Formats the value as a string %d – Formats the value as an integer %i – Same as %d %f – Formats the value as a floating point value. %o – Formats the value as an expandable DOM element (as in the Elements panel). %O – Formats the value as an expandable JavaScript object. %c – Formats the output string according to CSS styles you provide.
This package does not provide functions for the aliases console.debug and console.info – use Log instead.
For a more detailed explanation of the APIs, see for example Google's documentation at https://developers.google.com/chrome-developer-tools/docs/console-api.
Portions of this documentation are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.
Index ¶
- func Assert(b bool, msg interface{})
- func Clear()
- func Count(label string)
- func Dir(obj interface{})
- func DirXML(obj interface{})
- func Error(objs ...interface{})
- func Group(objs ...interface{})
- func GroupCollapsed(objs ...interface{})
- func GroupEnd()
- func Log(objs ...interface{})
- func Profile(label interface{})
- func ProfileEnd()
- func Time(label interface{})
- func TimeEnd(label interface{})
- func Timestamp(label interface{})
- func Trace()
- func Warn(objs ...interface{})
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
func Count(label string)
Count writes the number of times that it has been invoked at the same line and with the same label.
func Dir ¶
func Dir(obj interface{})
Dir prints a JavaScript representation of the specified object. If the object being logged is an HTML element, then the properties of its DOM representation are displayed.
func DirXML ¶
func DirXML(obj interface{})
DirXML Prints an XML representation of the specified object. For HTML elements, calling this method is equivalent to calling Log.
func Group ¶
func Group(objs ...interface{})
Group starts a new logging group with an optional title.
All console output that occurs after calling this function appears in the same visual group. Groups can be nested.
The title will be generated according to the rules of the Log function.
func GroupCollapsed ¶
func GroupCollapsed(objs ...interface{})
GroupCollapsed is like Group, except that the newly created group starts collapsed instead of open.
func Log ¶
func Log(objs ...interface{})
Log displays a message in the console. You pass one or more objects to this method, each of which are evaluated and concatenated into a space-delimited string. The first parameter you pass to Log may contain format specifiers.
func Profile ¶
func Profile(label interface{})
Profile starts a new CPU profile with an optional label.
func Time ¶
func Time(label interface{})
Time starts a new timer with an associated label. Calling TimeEnd with the same label will stop the timer and print the elapsed time.
func TimeEnd ¶
func TimeEnd(label interface{})
TimeEnd ends a timer that was started with Time and prints the elapsed time.
func Timestamp ¶
func Timestamp(label interface{})
Timestamp adds an event to the timeline during a recording session.