Add log level (optionally) to log.utils

This commit is contained in:
Fred Boniface 2023-03-16 20:22:18 +00:00
parent 76c40dbbae
commit 47447088a2
1 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,12 @@
async function out(msg) {
var time = new Date().toISOString();
console.log(`${time} - ${msg}`)
const environment = process.env.NODE_ENV;
async function out(msg, level = 'OTHR') {
if (environment === "production" && level === "info") {
return;
} else {
const time = new Date().toISOString();
console.log(`${time} - - ${level.toUpperCase()} - ${msg}`);
}
}
module.exports = {