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
1 changed files with 5 additions and 5 deletions

View File

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