Logger

Logger

Basic logger class that allows for selectively printing certain messages to the console, depending on the level of desired verbosity.

The states, in order of verbosity, are: NONE, NORMAL, SUPER, MASTER (MIN, as in minimal [potentialy between NONE and MIN])

Meant to be held as an object by classes to hold state of logging, and process logic, such as deciding whether or not to print/log something or not. All a utilizing class would need to do would be to hold a Logger object, and call .print(), allowing the rest to do its job.

Constructor

new Logger(_setting)

Source:

Initialize a Logger object.

Parameters:
Name Type Description
_setting Logger.state.ENUM

Internal state which the logger is set at.

Members

(static) state

Source:

Logger.state.ENUM - "NONE": 0, "MIN": 1, "NORMAL": 2, "SUPER": 3, "MASTER": 4

Methods

endl()

Source:

Simply a convenient alias for "\n".

print(arg1, …arg2) → {boolean}

Source:

Function defining print functionality itself.

Parameters:
Name Type Attributes Description
arg1 * | Logger.state.ENUM

IF only one argument has been passed, it is assumed that this is something to be printed. In every other case, this argument is a Logger.state.ENUM which represents which "level" of logging the statement is appropriate for (i.e., print(Logger.state.MASTER, mnemonic))

arg2 * <repeatable>

Print every additional argument, for syntactic sugar.

Returns:

success

Type
boolean

pureprint(msg)

Source:

Pure print function. Defines the absolute base functionality for printing. Essentially just an alias for console.log() at the moment.

Parameters:
Name Type Description
msg *

Prints argument to the console.

pureprintMulti() → {boolean}

Source:

Prints multiple arguments, iterating over them one at a time.

Returns:

success

Type
boolean

validate() → {boolean}

Source:

A simple function which determines whether or not the passed state "passes", taking the Logger's state value into account. If the state is lower than or the same as the current Logger state (where higher would mean "more verbose/permissive") then true is returned, otherwise, false.

Returns:

valid

Type
boolean