From d395b655120edae99eb8bff60660d3a5be3e7055 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 28 Sep 2023 11:37:09 +0100 Subject: [PATCH] Migrate issue.services to new logger Signed-off-by: Fred Boniface --- src/services/issue.services.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/issue.services.js b/src/services/issue.services.js index 1571a01..8b7c8eb 100644 --- a/src/services/issue.services.js +++ b/src/services/issue.services.js @@ -1,6 +1,6 @@ /* eslint-disable no-useless-escape */ const axios = require("axios"); -const log = require("../utils/logs.utils"); +import { logger } from "../utils/logger.utils"; const issueLabels = { bug: 120, @@ -11,7 +11,7 @@ const issueLabels = { }; async function processor(data) { - log.out("issueService.processor: Issue received", "info"); + logger.debug("issueService.processor: Issue received"); let out = {}; out.labels = [issueLabels[data?.label] || 0, issueLabels["web-user"]]; out.title = data?.subject.replace(/<[^>]+>|[\*\$]/g, ""); @@ -31,10 +31,10 @@ async function sendToGitea(body) { /* Need to read the output from the POST and pass the result upwards to the client.*/ if (res.status == 201) { - log.out("issueService.sendToGitea: Issue sent to Gitea", "info"); + logger.info("issueService.sendToGitea: Issue sent to Gitea"); return { status: res.status, message: "issue created" }; } else { - log.out(`issueService.sendToGitea: Fail to send issue: ${res.body}`, "err"); + logger.error(res.body, "issueService.sendToGitea: Fail to send issue"); return { status: res.status, message: "issue not created" }; } }