Module: console

cycligent. console

Capture console messages and logs them for display (or sending to a monitoring API)
Source:

Classes

Message

Members

(inner) messages :Array.<cycligent.console.Message>

Array of console messages (last 100)
Type:
  • Array.<cycligent.console.Message>
Source:

(inner) messageType :string

Message Type Enumeration
Type:
  • string
Source:

Methods

(inner) clear()

Clear console messages
Source:

(inner) count(typeopt) → {int}

Get message count by type or all
Parameters:
Name Type Attributes Description
type cycligent.console.messageType <optional>
The type of message for which the count is desired, or blank to get the total message count.
Source:
Returns:
The count
Type
int

(inner) error(messageOrObject, …additionalOutputopt)

Log informational message and present on console.

Avoid calling directly in favor of using the standard console.error() function which this simply captures.
Parameters:
Name Type Attributes Description
messageOrObject string | object Message or object in the style of console.
additionalOutput object <optional>
<repeatable>
Additional values or objects for output. If the first parameter was a string then these additional values replace the % items in order, if the first parameter was an object then the additional objects are concatenated to it for output.
Source:

(inner) info(messageOrObject, …additionalOutputopt)

Log informational message and present on console.

Avoid calling directly in favor of using the standard console.info() function which this simply captures.
Parameters:
Name Type Attributes Description
messageOrObject string | object Message or object in the style of console.
additionalOutput object <optional>
<repeatable>
Additional values or objects for output. If the first parameter was a string then these additional values replace the % items in order, if the first parameter was an object then the additional objects are concatenated to it for output.
Source:

(inner) log(messageOrObject, …additionalOutputopt)

Log informational message and present on console.

Avoid calling directly in favor of using the standard console.log() function which this simply captures.
Parameters:
Name Type Attributes Description
messageOrObject string | object Message or object in the style of console.
additionalOutput object <optional>
<repeatable>
Additional values or objects for output. If the first parameter was a string then these additional values replace the % items in order, if the first parameter was an object then the additional objects are concatenated to it for output.
Source:

(inner) message(messageType, messageOrObject, …additionalOutputopt)

Log message and present on console.
Parameters:
Name Type Attributes Description
messageType cycligent.console.messageType The type of message ("info", "log", "warn", "error").
messageOrObject string | object Message or object in the style of console.
additionalOutput object <optional>
<repeatable>
Additional values or objects for output. If the first parameter was a string then these additional values replace the % items in order, if the first parameter was an object then the additional objects are concatenated to it for output.
Source:

(inner) notify(func)

Register a notification function
Parameters:
Name Type Description
func function The function to be called whenever a console message is logged or console messages are cleared. The notify function should accept one argument (cycligent.console.Message) which will be contain the new console message. If the message is not passed to the function (undefined) then the console messages were cleared.
Source:

(inner) notifyClear(func)

Unregister a notification function
Parameters:
Name Type Description
func function The notify function to unregister.
Source:

(inner) warn(messageOrObject, …additionalOutputopt)

Log informational message and present on console.

Avoid calling directly in favor of using the standard console.warn() function which this simply captures.
Parameters:
Name Type Attributes Description
messageOrObject string | object Message or object in the style of console.
additionalOutput object <optional>
<repeatable>
Additional values or objects for output. If the first paramater was a string then these additional values replace the % items in order, if the first parameter was an object then the additional objects are concatenated to it for output.
Source: