Migrate pis.services to new logger

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-28 12:11:10 +01:00
parent d9e2445141
commit 648c72fa34

View File

@ -1,17 +1,14 @@
// Finds PIS Codes using DB Lookups
const db = require("../services/dbAccess.services");
const log = require("../utils/logs.utils");
const clean = require("../utils/sanitizer.utils");
import { logger } from "../utils/logger.utils";
const supported = ["GW", "UK"];
async function findPisByOrigDest(start, end) {
log.out(
"pisServices.findPisByOrigDest: Searching for PIS for Orig: " +
`${start}, Dest: ${end}`,
"dbug"
);
logger.debug(`pisServices.findPisByOrigDest: Searching for Orig: ${start}, Dest: ${end}`);
const firstCrs = clean.cleanApiEndpointTxt(start.toLowerCase());
const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase());
const query = {
@ -33,7 +30,7 @@ async function findPisByOrigDest(start, end) {
}
async function findPisByCode(code) {
log.out(`pisServices.findPisByCode: Searching for PIS code: ${code}`, "dbug");
logger.debug(`pisServices.findPisByCode: Searching for PIS code: ${code}`);
const cleanCode = clean.removeNonNumeric(code);
const query = {
code: parseInt(cleanCode),