Output

libflitter/utility/services/Output~ Output

Service for managing output to the console based on logging level.


Constructor

new Output()

Extends

Members

(static) name

Get the name of this service: 'output'

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

Type:
  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

Type:
  • Array.<string>

level :number

The logging level.

Type:
  • number

timestamp :boolean

If true, includes a timestamp in the output. Default false.

Type:
  • boolean

Methods

(private) __get_caller_info() → {string}

Get the trace name of the output method caller. Assumes that the caller is the fourth item in the stack. For example: Output.__get_caller_info < Output.__timestamp < Output.error < Original Caller

Returns:
  • the caller's name (e.g. "ClassName.method")
Type
string

(private) __timestamp() → {string}

Get a color-formatted timestamp string.

Returns:
Type
string

debug(msg, levelopt)

Send a [DEBUG] message. The logging level must be greater than or equal to the message level for it to display.

Parameters:
Name Type Attributes Default Description
msg string
level number <optional>
5

the message level

error(msg, levelopt)

Send an [ERROR] message. The logging level must be greater than or equal to the message level for it to display.

Parameters:
Name Type Attributes Default Description
msg string
level number <optional>
1

the message level

info(msg, levelopt)

Send an [INFO] message. The logging level must be greater than or equal to the message level for it to display.

Parameters:
Name Type Attributes Default Description
msg string
level number <optional>
4

the message level

message(msg, levelopt)

Send a [MESSAGE] message. The logging level must be greater than or equal to the message level for it to display.

Parameters:
Name Type Attributes Default Description
msg string
level number <optional>
3

the message level

success(msg, levelopt)

Send a [SUCCESS] message. The logging level must be greater than or equal to the message level for it to display.

Parameters:
Name Type Attributes Default Description
msg string
level number <optional>
1

the message level

warn(msg, levelopt)

Send a [WARNING] message. The logging level must be greater than or equal to the message level for it to display.

Parameters:
Name Type Attributes Default Description
msg string
level number <optional>
2

the message level