ServerJS/API/console: Difference between revisions
Jump to navigation
Jump to search
(Added a preliminary proposal for the console module API.) |
(Redacted print, pass, and fail.) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Many client-side libraries already support a JavaScript console object. Since this functionality is useful on the server, and to ease migration of client-side JavaScript to the server, server-side JavaScript platforms need to provide a "console" object suitable for use with minimal modification to existing scripts. Rather than provide a "console" free variable like web browsers, interoperable JavaScript modules may explicitly import the "console" module and bind it to a module local "console" variable. | |||
= Specification = | |||
The "console" top-level module must be available in all platforms. The module must provide the following exports: | The "console" top-level module must be available in all platforms. The module must provide the following exports: | ||
; log(message | ; log(message) : logs a message | ||
; info(message) : logs an informational message | ; info(message) : logs an informational message | ||
; warn(message) : logs a warning message | ; warn(message) : logs a warning message | ||
; error(message) : logs an error message | ; error(message) : logs an error message | ||
Messages may be any reference. Names must be strings. | |||
Latest revision as of 18:34, 14 April 2009
Many client-side libraries already support a JavaScript console object. Since this functionality is useful on the server, and to ease migration of client-side JavaScript to the server, server-side JavaScript platforms need to provide a "console" object suitable for use with minimal modification to existing scripts. Rather than provide a "console" free variable like web browsers, interoperable JavaScript modules may explicitly import the "console" module and bind it to a module local "console" variable.
Specification
The "console" top-level module must be available in all platforms. The module must provide the following exports:
- log(message)
- logs a message
- info(message)
- logs an informational message
- warn(message)
- logs a warning message
- error(message)
- logs an error message
Messages may be any reference. Names must be strings.
Prior Art
- Firebug
- Safari 1.3 Console
- Opera JavaScript Console
- Internet Explorer 8 JavaScript Console