To the extent possible under law, the editors have waived all copyright and related or neighboring rights to this work. In addition, as of 14 October 2014, the editors have made this specification available under the Open Web Foundation Agreement Version 1.0, which is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. Parts of this work may be from another specification document. If so, those parts are instead covered by the license of that specification document.
This specification standardizes APIs for console debugging facilities.
Please join us in the issue tracker for more discussion.
@TODO: Write this.
Console
[NoInterfaceObject] interface Console { // Logging void assert(boolean condition, optional anymessage); void clear(); void count(optional DOMString label = ""); void debug(any... data); void error(any... data); void info(any... data); void log(any... data); void table(anytabularData, optional sequence<DOMString> properties); void trace(any... data); void warn(any... data); // Grouping void group(any... data); void groupCollapse(any... data); void groupEnd(); // Timing void time(DOMString label); void timeEnd(DOMString label); }; partial interface Window { attribute Console console; }; partial interface WorkerGlobalScope { attribute Console console; };
The side effect of running the logger function with data and logLevel set to log.
The side effect of running the logger function with data and logLevel set to error.
The side effect of running the logger function with data and logLevel set to info.
The side effect of running the logger function with data and logLevel set to log.
Try to construct a table with the columns of the properties of tabularData and rows of tabularData and log it with a logLevel of log. Fall back to just logging the argument if it can’t be parsed as tabular. This will need a good algorithm.
The side effect of running the logger function with data and logLevel set to error.
The side effect of running the logger function with data and logLevel set to warn.
Start an internal timer stored in the timer table as label.
Store the current value of the internal timer stored as label as duration. Remove the timer from tha timer table. Then, the side effect of running the logger function with arguments label and duration.
Note: Consider keeping these format specifiers general enough to be re-used by other specifications.
TODO: Define an interface that allows JavaScript objects to format themselves for inspection.
All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.
The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this specification are to be interpreted as described in RFC2119. For readability, these words do not appear in all uppercase letters in this specification. [RFC2119]
Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent.
[NoInterfaceObject] interface Console { // Logging void assert(boolean condition, optional anymessage); void clear(); void count(optional DOMString label = ""); void debug(any... data); void error(any... data); void info(any... data); void log(any... data); void table(anytabularData, optional sequence<DOMString> properties); void trace(any... data); void warn(any... data); // Grouping void group(any... data); void groupCollapse(any... data); void groupEnd(); // Timing void time(DOMString label); void timeEnd(DOMString label); }; partial interface Window { attribute Console console; }; partial interface WorkerGlobalScope { attribute Console console; };