From 6721d47f0297f22c7c612996fa09e01c34e41681 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 27 Sep 2023 20:35:39 +0100 Subject: [PATCH] Port find.services to new logger Signed-off-by: Fred Boniface --- src/services/find.services.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/services/find.services.js b/src/services/find.services.js index ac15dd2..94624e1 100644 --- a/src/services/find.services.js +++ b/src/services/find.services.js @@ -1,16 +1,17 @@ // Parse and return a find request -const log = require("../utils/logs.utils"); // Log Helper const db = require("../services/dbAccess.services"); const san = require("../utils/sanitizer.utils"); +import { logger } from "../utils/logger.utils"; + // DB Query: query(collection, query) // Define collection as all queries are for the "corpus" collection. const col = "corpus"; async function name(id) { - log.out(`findServices.name: Finding station name: ${id}`, "info"); + logger.debug(`findServices.name: Finding station name: ${id}`); var name = san.cleanApiEndpointTxt(id.toUpperCase()); let query = { NLCDESC: name }; //var data = await db.query(col,query) @@ -18,7 +19,7 @@ async function name(id) { } async function crs(id) { - log.out(`findServices.crs: Finding crs: ${id}`, "info"); + logger.debug(`findServices.crs: Finding crs: ${id}`); var crs = san.cleanApiEndpointTxt(id.toUpperCase()); let query = { "3ALPHA": crs }; //var data = await db.query(col,query) @@ -26,16 +27,16 @@ async function crs(id) { } async function nlc(id) { - log.out(`findServices.nlc: Finding nlc: ${id}`, "info"); + logger.debug(`findServices.nlc: Finding nlc: ${id}`); var nlc = san.cleanApiEndpointNum(id); let query = { NLC: parseInt(nlc) }; - log.out(`findServices.nlc: NLC Converted to int: ${query}`, "info"); + logger.trace(`findServices.nlc: NLC Converted to int: ${query}`); //var data = await db.query(col,query) return await db.query(col, query); } async function tiploc(id) { - log.out(`findServices.tiploc: Finding tiploc: ${id}`, "info"); + logger.debug(`findServices.tiploc: Finding tiploc: ${id}`); var tiploc = san.cleanApiEndpointTxt(id.toUpperCase()); let query = { TIPLOC: tiploc }; //var data = await db.query(col,query) @@ -43,7 +44,7 @@ async function tiploc(id) { } async function stanox(id) { - log.out(`findServices.stanox: Finding stanox: ${id}`, "info"); + logger.debug(`findServices.stanox: Finding stanox: ${id}`); var stanox = san.cleanApiEndpointNum(id); let query = { STANOX: String(stanox) }; //var data = await db.query(col,query)