We will be implementing a basic logging system which write to a single file. For now this file is not rotated or changed, it will need to be periodically deleted to “clear” the log. Logs will be written in a CSV format so that we can import them into a spreadsheet app for analysis. The format of a log message will look like the following…
2024-09-24 18:34:12, The message here, ERROR, MODULE_NAME, AUTH_0
Write Log File
Create a log function that adds a single line to a log file. When this function runs it should check to see if there is a log file present and if not create one. This function is part of core.
Format Log Message
The log function accepts a message to write. In addition to this we should automatically add the following data to a line logged in the file.
Timestamp
Module that sent the message
Auth Level
Log Type
In addition to a message the log function should accept a type argument. By default this will be set to “Error” but it can also be the following…
ERROR
WRITE
DELETE
The function probably has the following JSDoc...
/**
* log
* Log a message to the log file. If a log file does not exist create one.
*
* @param {string} module
* @param {string} message
* @param {string} type
* @returns {boolean}
*/
This ticket is complete when we can write a message to the log file in this format.
We will be implementing a basic logging system which write to a single file. For now this file is not rotated or changed, it will need to be periodically deleted to “clear” the log. Logs will be written in a CSV format so that we can import them into a spreadsheet app for analysis. The format of a log message will look like the following…
Write Log File Create a log function that adds a single line to a log file. When this function runs it should check to see if there is a log file present and if not create one. This function is part of core.
Format Log Message The log function accepts a message to write. In addition to this we should automatically add the following data to a line logged in the file.
Log Type In addition to a message the log function should accept a type argument. By default this will be set to “Error” but it can also be the following…
The function probably has the following JSDoc...
This ticket is complete when we can write a message to the log file in this format.