ddstats-server/libs/utils/log.js
2021-11-04 16:19:18 +01:00

14 lines
448 B
JavaScript

/**
* This function creates a custom logging method that adds a prefix evrytime used.
* This is so that you can see what component has done what.
* Example:
* The database-component would log with the prefix 'database'
*
* @param {string} prefix The prefix for the logging-function.
* @returns {function} The created log function.
*/
export default function initLog(prefix) {
return string => console.log(`${prefix} >>> ${string}`)
}