helpers/log

Console output helper

Display output text to the console in a number of predefined styles.

This module exports the log function which includes the other documented functions as properties of itself.

Usage:

const log = require('./log.js');
log("Log a general message");
log.info("Log an informational message");
Source:

Methods

(inner) error(text, toStdErropt)

Source:

Log an error message to the console / stderr (by default)

Parameters:
Name Type Attributes Default Description
text string

Message

toStdErr boolean <optional>
true

Set to false to print to stdout

(inner) info(text)

Source:

Log an information message to the console / stdout

Parameters:
Name Type Description
text string

Message

(inner) log(text)

Source:
Properties:
Name Type Description
info function

See info

warning function

See warning

error function

See error

raw function

See raw

Log a general message to the console / stdout

Parameters:
Name Type Description
text string

Message

(inner) raw(parts)

Source:

Explicitly define the console output style. The components of the output are specified as a list of objects with the properties:

  • "text": The text to display
  • "chalk": The chalk style components (ex: bgYellow.black)
Parameters:
Name Type Description
parts Array.<Object>

List of output style components

Properties
Name Type Attributes Description
text string

The text to output

chalk string <optional>

The chalk style components (ex: bgYellow.black)

(inner) warning(text, toStdErropt)

Source:

Log a warning message to the console / stderr (by default)

Parameters:
Name Type Attributes Default Description
text string

Message

toStdErr boolean <optional>
true

Set to false to print to stdout