This module provides some functions for faster
logging of different actions on the DB.
- Version:
-
- 1.0
Members
-
<inner> showConsoleOutput
-
If true, it will output to the console, otherwise it will not output anything. It's good to turn it off in testing to increase readability. Leave on for debugging.
Methods
-
<inner> log(type, username, tableName, entryID, message, Optional)
-
Helper function to reduce duplication.
Parameters:
Name Type Description type
string Type of action taken: insert, update or delete. username
string User that has done that action. tableName
string The table that was involved in the action. entryID
string The key of the entry from the previous table that was involved in the action. message
string Optional message that can provide more details about the action. Optional
function action, called with the result of insertQuery. -
<inner> logDelete(username, tableName, entryID, message, Optional)
-
Call this to log a delete action.
Parameters:
Name Type Description username
string User that has done that action. tableName
string The table that was involved in the action. entryID
string The key of the entry from the previous table that was involved in the action. message
string Optional message that can provide more details about the action. Optional
function action, called with the result of insertQuery. -
<inner> logInsert(username, tableName, entryID, message, Optional)
-
Call this to log an insert action.
Parameters:
Name Type Description username
string User that has done that action. tableName
string The table that was involved in the action. entryID
string The key of the entry from the previous table that was involved in the action. message
string Optional message that can provide more details about the action. Optional
function action, called with the result of insertQuery. -
<inner> logOther(username, tableName, entryID, message, Optional)
-
Call this to log any other action. Say, requested editing, or attempted an invalid login etc.
Parameters:
Name Type Description username
string User that has done that action. tableName
string The table that was involved in the action. entryID
string The key of the entry from the previous table that was involved in the action. message
string Message that provides details about the action. In this case the message is compulsory as it needs to explain what happened. Optional
function action, called with the result of insertQuery. -
<inner> logUpdate(username, tableName, entryID, message, Optional)
-
Call this to log an update action.
Parameters:
Name Type Description username
string User that has done that action. tableName
string The table that was involved in the action. entryID
string The key of the entry from the previous table that was involved in the action. message
string Optional message that can provide more details about the action. Optional
function action, called with the result of insertQuery.