JSMA console
Overview
What can JSMA console do for me?
JSMA console offers convenient access to the console object to debug your makros
Index
- 1 Overview
- 2 Index
- 3 Methods
- 3.1 bool console.assert(assertion, [objects])
- 3.2 void console.debug([objects])
- 3.3 void console.error([objects])
- 3.4 void console.info([objects])
- 3.5 void console.log([objects])
- 3.6 void console.setLogHandler(fun)
- 3.7 void console.time(timer_label)
- 3.8 int console.timeEnd(timer_label)
- 3.9 string console.trace()
- 3.10 void console.warn([objects])
Methods
The JSMA console provides the following methods:
bool console.assert(assertion, [objects])
Returns false when the assertion is also false. Otherwise it just logs the [objects].
Example
[...]
var a = 41;
console.assert(function() { return a == 42 }, a); // => false
[...]Parameter assertion:function (required)
A function that will be evaluated and checked for falsehood.
Parameter objects (optional)
void console.debug([objects])
Outputs a message to the log file or log handler using the debug logging flag.
Example
[...]
console.debug('debug objects:', anObject, anotherObject);
[...]Parameter objects (optional)
void console.error([objects])
Outputs a message to the log file or log handler using the error logging flag.
Example
[...]
console.error('error:', anObject, anotherObject);
[...]Parameter objects (optional)
void console.info([objects])
Outputs a message to the log file or log handler using the info logging flag.
Example
[...]
console.info('info:', anObject, anotherObject);
[...]Parameter objects (optional)
void console.log([objects])
Outputs a message to the log file or log handler using the info logging flag. (The same as console.info)
void console.setLogHandler(fun)
Override the file logger with a custom log handler.
Example
[...]
console.setLogHandler(function(msg, caller_content_name, logged_objects) {})
[...]Parameter fun:function (required)
A function that will be called with these parameters:
the log message (all logged objects joined as a string)
the name of the calling content
the logged objects
void console.time(timer_label)
Starts a named timer.
Example
[...]
console.time('some-timer-name');
[...]Parameter timer_label:string (required)
A label for the new timer.
int console.timeEnd(timer_label)
Ends a timer and returns the elapsed time in milliseconds.
Example
[...]
console.timeEnd('some-timer-name'); // => 4480
[...]Parameter timer_label:string (required)
The label of the timer to be stopped.
string console.trace()
Returns the current stack at the moment this method is called
Example
[...]
console.trace()
[...]void console.warn([objects])
Outputs a message to the log file or log handler using the warn logging flag.
Example
[...]
console.warn('warning:', anObject, anotherObject);
[...]