Elementals.js

Latest Version: 2.0 RC 3 14 March 2017

Method _.log

Summary:

Logs a message by way of Console.log, Window.alert, appending to document.body, or by ignoring it silently. Allows one routine wrapper to be used for different types of logging.

Calling Convention:
_.log(message, loggingType)
Parameters:
message
The message to be logged.
loggingType

A string containing one of:

  • 'alert' -- Calls Window.alert
  • 'append' -- Appends a <br> followed by the message to document.body
  • 'error' -- Calls throw new Error()
  • 'log' -- Calls Console.log. If Console is unavailable 'append' will be called instead.
  • 'silent' -- no action is taken. This is also the default behavior for unrecognized loggingType values.
  • 'warn' -- Calls Console.warn. If Console is unavailable 'append' will be called instead.
Returns:
Nothing