From 83a3a06386672ee5125b36fa8ffc582ed8071632 Mon Sep 17 00:00:00 2001 From: Rat Date: Fri, 18 Nov 2022 15:32:59 -0800 Subject: [PATCH 1/2] Added configurable setting for log folder, falls back to config path if not set --- src/utils/logger.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/logger.js b/src/utils/logger.js index 5ad935469..19c6a71e2 100644 --- a/src/utils/logger.js +++ b/src/utils/logger.js @@ -1,6 +1,7 @@ /* eslint-disable no-console */ import { join } from "path"; import { format as utilFormat } from "node:util"; +import checkAndCopyConfig, { getSettings } from "utils/config/config"; import winston from "winston"; @@ -8,6 +9,9 @@ let winstonLogger; function init() { const configPath = join(process.cwd(), "config"); + checkAndCopyConfig("settings.yaml"); + const settings = getSettings(); + const logpath = settings.logpath || configPath; function combineMessageAndSplat() { return { @@ -57,7 +61,7 @@ function init() { winston.format.timestamp(), winston.format.printf(messageFormatter) ), - filename: `${configPath}/logs/homepage.log`, + filename: `${logpath}/logs/homepage.log`, handleExceptions: true, handleRejections: true, }), From c8806a87755157991462c0ffd33b26e2cbeb9140 Mon Sep 17 00:00:00 2001 From: Rat Date: Sat, 19 Nov 2022 12:10:29 -0800 Subject: [PATCH 2/2] lint fix --- src/utils/logger.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/logger.js b/src/utils/logger.js index 19c6a71e2..048c5356c 100644 --- a/src/utils/logger.js +++ b/src/utils/logger.js @@ -1,10 +1,11 @@ /* eslint-disable no-console */ import { join } from "path"; import { format as utilFormat } from "node:util"; -import checkAndCopyConfig, { getSettings } from "utils/config/config"; import winston from "winston"; +import checkAndCopyConfig, { getSettings } from "utils/config/config"; + let winstonLogger; function init() {