JSMA console

Overview

What can JSMA console do for me?

JSMA console offers convenient access to the console object to debug your makros


Index

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);
[...]

Parameter objects (optional)