diff --git a/src/utils/ldb.utils.js b/src/utils/ldb.utils.js index dea6eae..a99b74d 100644 --- a/src/utils/ldb.utils.js +++ b/src/utils/ldb.utils.js @@ -4,10 +4,10 @@ const san = require('../utils/sanitizer.utils') // Sanitiser async function checkCrs(input){ var INPUT = input.toUpperCase() - log.out(`ldbUtils.checkCrs: Building database query to find: '${INPUT}'`) + log.out(`ldbUtils.checkCrs: Building database query to find: '${INPUT}'`, "info") var query = {'$or':[{'3ALPHA':INPUT},{'TIPLOC':INPUT},{'STANOX':INPUT}]}; var result = await db.query("stations", query) - log.out(`ldbUtils.checkCrs: Query results: ${JSON.stringify(result)}`) + log.out(`ldbUtils.checkCrs: Query results: ${JSON.stringify(result)}`, "info") return result } @@ -27,9 +27,9 @@ async function cleanMessages(input){ // Needs to be moved to the frontend `ensur async function cleanServices(input){ // Need to triple check but I don't think this is used anymore. var out = [] if (!Array.isArray(input)) { - log.out(`ldbUtils.cleanServices: Transforming input: ${input}`) + log.out(`ldbUtils.cleanServices: Transforming input: ${input}`, "depr") out.push(input) - log.out(`ldbUtils.cleanServices: Returning output: ${out}`) + log.out(`ldbUtils.cleanServices: Returning output: ${out}`, "depr") return out; } else { return input; diff --git a/src/utils/log.utils.js b/src/utils/log.utils.js index 8a67762..db0b3f0 100644 --- a/src/utils/log.utils.js +++ b/src/utils/log.utils.js @@ -1,11 +1,11 @@ const environment = process.env.NODE_ENV; -async function out(msg, level = 'OTHR') { +async function out(msg, level = 'othr') { if (environment === "production" && level === "info") { return; } else { const time = new Date().toISOString(); - console.log(`${time} - - ${level.toUpperCase()} - ${msg}`); + console.log(`${time} - ${level.toUpperCase()} - ${msg}`); } } diff --git a/src/utils/sanitizer.utils.js b/src/utils/sanitizer.utils.js index 908f3bf..28aade0 100644 --- a/src/utils/sanitizer.utils.js +++ b/src/utils/sanitizer.utils.js @@ -19,7 +19,7 @@ string.removeSpace("@abcd efgh"); // @abcdefgh function cleanApiEndpointTxt(input) { var output = clean.sanitize.keepSpace(input) if (output != input){ - log.out(`sanitizerUtils.cleanApiEndpoint: WARN: Sanitizing changed string. Input = ${input}`); + log.out(`sanitizerUtils.cleanApiEndpoint: WARN: Sanitizing changed string. Input = ${input}`, "warn"); } return output } @@ -27,7 +27,7 @@ function cleanApiEndpointTxt(input) { function cleanApiEndpointNum(input) { var output = clean.sanitize.keepNumber(input) if (output != input){ - log.out(`sanitizerUtils.cleanApiEndpointNum: WARN: Sanitizing changed string. Input = ${input}`); + log.out(`sanitizerUtils.cleanApiEndpointNum: WARN: Sanitizing changed string. Input = ${input}`, "warn"); } return output }