Description

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");
					
Details

Methods


<inner> log( text )

Description

Log a general message to the console / stdout

Parameters
Name Type Description
text string

Message

Properties
Name Type Description
info function

See info

warning function

See warning

error function

See error

raw function

See raw

Details

<inner> info( text )

Description

Log an information message to the console / stdout

Parameters
Name Type Description
text string

Message

Details

<inner> warning( text [, toStdErr ] )

Description

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

Details

<inner> error( text [, toStdErr ] )

Description

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

Details

<inner> raw( parts )

Description

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 Attributes Description
parts Array.<Object>

List of output style components

parts[].text string

The text to output

parts[].chalk string <optional>

The chalk style components (ex: bgYellow.black)

Details

<inner> history()

Description

Get the log history (plain text)

Details