Module: loggers

Contains all of the functions necessary for logging to the console, and logging to a system-specified log file. Additional logic is in place to allow the configuration file to define which modules/files & functions should participate in logging operations.

Author:
  • Seth Hollingsead
Source:

Requires

Methods

(inner) consoleLog(classPath, message) → {void}

Compares the class path to a series of configuration settings to determine if we should log to the console or not. Also can provisionally log to a log file as well since the console is technically a transient data output.

Parameters:
Name Type Description
classPath string

The class path for the caller of this function file.function or class.method.

message string

The message or data contents that should be dumped to the output.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) consoleLogProcess(debugSetting, logFile, classPath, message, loggingToFileAndConsole) → {void}

A function that will print a message to a log file and the console, or just the console. The output depends on if there was a txt/log file specified or not.

Parameters:
Name Type Description
debugSetting boolean

A TRUE or FALSE value to indicate if the log action is enabled or not.

logFile string

The path to the log file where the message should be logged.

classPath string

The class path for the caller of this function file.function or class.method.

message string

The message or data contents that should be dumped to the output (log file and/or console).

loggingToFileAndConsole boolean

A TRUE or FALSE value to indicate if the log should be done to the specified log file and the console. If no log file is specified by the caller/settings system then this will be FALSE and only the console will be logged.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) consoleTableLog(classPath, tableData, columnNames) → {void}

Prints out a table with the data provided in the input tableDataArray.

Parameters:
Name Type Description
classPath string

The class path for the caller of this function file.function or class.method.

tableData array.<object>

An array of objects that should be printed to the console as if it was data.

columnNames array.<string>

An array of column names that should be used when outputting the table.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) constantsValidationSummaryLog(message, passFail) → {void}

Displays a constants log validation summary pass-fail results depending on the appropriate settings flag, which is passed in by the caller.

Parameters:
Name Type Description
message string

The message that should be displayed, if the setting determines that it should be displayed.

passFail boolean

True or False to indicate if the pas or fail message should be displayed to the console log.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) getLogFileNameAndPath() → {string}

Determines, using configuration settings what the log file name and path should be.

Author:
  • Seth Hollingsead
Source:
Returns:

The full path and file name for the log file.

Type
string

(inner) parseClassPath(logFile, classPath, message) → {string}

Parses the class path and message pulling it apart for logging and looking at custom debug settings.

Parameters:
Name Type Description
logFile string

The file name and path to the log file where the data should be printed.

classPath string

The class path for the caller of this function file.function or class.method.

message string

The message or data contents that should be dumped to the output.

Author:
  • Seth Hollingsead
Source:
Returns:

Returns the message that should be printed out to the console and logged to the log file.

Type
string

(inner) printMessageToFile(file, message) → {void}

Prints a message to a log/text file.

Parameters:
Name Type Description
file string

The file path and file name where message data should be printed.

message string

The message that should be logged to the log file if the specified flag is true.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) validMessage(outputMessage, originalMessage) → {boolean}

Looks at the parsed/processed output message and the original message to determine if the message is a valid message to dump to the console and/or the log file (if specified).

Parameters:
Name Type Description
outputMessage string | integer | boolean | object

The message that has been parsed/processed.

originalMessage string | integer | boolean | object

The original message passed in before processing/parsing.

Author:
  • Seth Hollingsead
Source:
Returns:

A TRUE or FALSE to indicate if the output message should be dumped to the log file and/or the console.

Type
boolean