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 files to define which modules/files & functions should participate in logging operations. Additional refactoring enables a schema driven logging control logic, where-as the schema can be overridden by a client application/framework to provide custom client specific logging logic.

Author:
  • Seth Hollingsead
Source:
Author:
  • Seth Hollingsead
Source:

Requires

Methods

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

Uses the classPathControlFlag to look up to a namespace configuration setting, or a configuration control flag 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
classPathControlFlag string

The class path for the caller of this function file.function or class.method to a configuration setting control flag that is either true or false, OR the name of a control flag that should be evaluated as either true or false to indicate if the console log, file log, and log transmission should be performed.

message string

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

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(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(logOptions) → {void}

A function that will determine how and where log messages are logged. logs could be logged to the console, to a log file, and to a socket client that will transmit the log message across a web-socket to a remote socket server.

Parameters:
Name Type Description
logOptions *

A JSON object that contains data and meta-data that will be used to determine how and where a console log message should be logged. The object example prototype is: logFile: logFile, isControlFlag: controlFlagObject.isControlFlag, classPathControlFlag: classPathControlFlag, configurationNamespace: configurationNamespace, configurationName: configurationName, debugFileSetting: debugFileSetting, debugFunctionSetting: debugFunctionSetting, message: message, isFileLoggingOn: isFileLoggingOn, ifSocketLoggingOn: isSocketLoggingOn, classPath: classPathControlFlag

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) 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 pass or fail message should be displayed to the console log.

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 pass 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) 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) loggerSchemaGateLogic(classPathControlFlag) → {object}

Looks up the classPathControlFlag in the loggerSchema to determine if the logging should proceed or not. And also if the control flag value is found or not found which may determine if the consoleLog will proceed to check or not check the debug configuration namespace from the classPath.

Parameters:
Name Type Description
classPathControlFlag string

The class path for the caller of the consoleLog function file.function or class.method to a configuration setting control flag that is either true or false, OR the name of a control flag that should be evaluated as either true or false to indicate if the console log, file log, and log transmission should be performed.

Author:
  • Seth Hollingsead
Source:
Returns:

A JSON object that contains some meta-data and boolean values. 2 booleans to indicate if the control flag is a control flag that was found or not found, and also a second boolean that indicates if the control flag value is true or false to indicate if the console logging should proceed, or not proceed. the JSON object structure returned will be as follows: { isControlFlag: true, controlFlagValue: true, logFileConfigFlagName: logFileEnabled logSocketTransmissionFlagName: logToSocketTransmissionEnabled ...all additional flagNames }

Type
object

(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) 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

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:
Author:
  • Seth Hollingsead
Source:

Requires

Methods

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

Uses the classPathControlFlag to look up to a namespace configuration setting, or a configuration control flag 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
classPathControlFlag string

The class path for the caller of this function file.function or class.method to a configuration setting control flag that is either true or false, OR the name of a control flag that should be evaluated as either true or false to indicate if the console log, file log, and log transmission should be performed.

message string

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

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(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(logOptions) → {void}

A function that will determine how and where log messages are logged. logs could be logged to the console, to a log file, and to a socket client that will transmit the log message across a web-socket to a remote socket server.

Parameters:
Name Type Description
logOptions *

A JSON object that contains data and meta-data that will be used to determine how and where a console log message should be logged. The object example prototype is: logFile: logFile, isControlFlag: controlFlagObject.isControlFlag, classPathControlFlag: classPathControlFlag, configurationNamespace: configurationNamespace, configurationName: configurationName, debugFileSetting: debugFileSetting, debugFunctionSetting: debugFunctionSetting, message: message, isFileLoggingOn: isFileLoggingOn, ifSocketLoggingOn: isSocketLoggingOn, classPath: classPathControlFlag

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) 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 pass or fail message should be displayed to the console log.

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 pass 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) 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) loggerSchemaGateLogic(classPathControlFlag) → {object}

Looks up the classPathControlFlag in the loggerSchema to determine if the logging should proceed or not. And also if the control flag value is found or not found which may determine if the consoleLog will proceed to check or not check the debug configuration namespace from the classPath.

Parameters:
Name Type Description
classPathControlFlag string

The class path for the caller of the consoleLog function file.function or class.method to a configuration setting control flag that is either true or false, OR the name of a control flag that should be evaluated as either true or false to indicate if the console log, file log, and log transmission should be performed.

Author:
  • Seth Hollingsead
Source:
Returns:

A JSON object that contains some meta-data and boolean values. 2 booleans to indicate if the control flag is a control flag that was found or not found, and also a second boolean that indicates if the control flag value is true or false to indicate if the console logging should proceed, or not proceed. the JSON object structure returned will be as follows: { isControlFlag: true, controlFlagValue: true, logFileConfigFlagName: logFileEnabled logSocketTransmissionFlagName: logToSocketTransmissionEnabled ...all additional flagNames }

Type
object

(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) 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