Migrate stats.services to new logger

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-28 14:47:41 +01:00
parent 7c40f2fd98
commit dc9a5e15da

View File

@ -1,8 +1,9 @@
const log = require("../utils/logs.utils"); // Log Helper
const db = require("../services/dbAccess.services");
const os = require("os");
const vers = require("../configs/version.configs");
import { logger } from "../utils/logger.utils";
async function buildJson() {
let json = {};
json.count = {};
@ -34,14 +35,13 @@ async function buildJson() {
}
async function hits() {
log.out("statsServices.hits: Statistics Requested", "info");
logger.debug("statsServices.hits: Statistics Requested");
const out = await buildJson();
log.out(`statsServices.hits: Sending Data: ${JSON.stringify(out)}`, "info");
return out;
}
async function getVersions() {
log.out("statsServices.getVersions: Fetching versions", "info");
logger.debug("statsServices.getVersions: Fetching versions");
const dbMan = await db.query("versions", { target: "dbmanager" });
const mqClt = await db.query("versions", { target: "mq-client" });
const data = {
@ -53,7 +53,7 @@ async function getVersions() {
}
async function statistics() {
log.out("statsServices.statistics: Fetching statistics", "info");
logger.debug("statsServices.statistics: Fetching statistics");
const countersPromise = db.query("meta", { target: "counters" });
const timetablePromise = db.query("meta", { target: "timetable" });