Namespace: Logging:log

Logging:log

Source:

Methods

log() → {Object}

Logs a message to the console. Prevents errors in browsers, that don't support this feature. This method is chainable (always returns a chainable object with all methods) and wraps all advanced logging methods like dir, assert and count (https://developer.mozilla.org/en-US/docs/Web/API/Console).

Use setLogLevel() on the chainable object to globally define the current log level. 'log' is the default value and allows for all logs to appear on console. 'warn' reduces logs to warnings and errors. 'err' only shows errors on console. Use this to mute debug stuff in production.

You can use the method tryToLogToParent(true/false) to instruct log to try to log to the parent window also, which comes in handy if you are developing inside a same domain iframe.

Parameters:
Name Type Attributes Description
... * <optional>
<repeatable>

any number of arguments you wish to log

Source:
Returns:
- chainable logging object
Type
Object
Example
log(randomVar, 'string');
log(false, true);
log().group().log(1).log(2).log(3).groupEnd().error('ouch');
log().setLogLevel('warn');
log('test', {test : 'test'}).setLogLevel('warn').warn('oh noez, but printed').log('not printed').setLogLevel('log').clear();
log().tryToLogToParent().log('hooray times two').tryToLogToParent(false);