Yo.utils.log

Use this function to concatenate a supplied array of strings and print the resulting string to the console.log. If the browser does not support the console log, this function takes no action.

Logging to the console is useful for debugging purposes but is typically disabled for production. With Yottaa, by default logging to the console log is turned off. To turn on logging to the console, enter this command:

Yo.configure({log: true});

Yo.utils.log tests whether log: true is configured, and concatenates the strings only if the answer is Yes. Yo.utils.log also checks to see if the argument was a DOM element and outputs the nodeName and the ID.

Prerequisites

The following command to load the appropriate version of the Rapid+JS Library must precede the use of this function on the page. Specify your own site key:

<script src="https://rapid-cdn.yottaa.com/rapid/lib/sitekey.js"></script>

Syntax

Yo.utils.log("string" [, "string"]...)

Returns

A string concatenated from the supplied array of parameters, separated by spaces, printed to console.log.

Parameters

Parameter

Description

string

Each parameter is a string, or resolves to a string. You may specify any number of strings, separated by commas.

 

Examples

This example concatenates the parameters into the message "Found a script, <script name>, and it is not delayed" and writes that message to the console.log.

Yo.configure({log: true});
Yo.utils.log('Found a script,', scriptNode, ', and it is not delayed');

This example tests whether the object someThing is a function, and writes one of these messages to the console.log:

"someThing is a function EQUALS true" or "someThing is a function EQUALS false".

Yo.configure({log: true});
Yo.utils.log("someThing is a function EQUALS ", Yo.utils.isFunction(someThing));