From 28b28866a266912dd311532c26b1005ec2a84d8a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 7 Feb 2021 21:13:52 -0500 Subject: [PATCH] ImportHandler: Move the logger up Also change the name to something shorter. --- src/node/handler/ImportHandler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 9653bc929..62f21f3b2 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -33,6 +33,8 @@ const importEtherpad = require('../utils/ImportEtherpad'); const log4js = require('log4js'); const hooks = require('../../static/js/pluginfw/hooks.js'); +const logger = log4js.getLogger('ImportHandler'); + // `status` must be a string supported by `importErrorMessage()` in `src/static/js/pad_impexp.js`. class ImportError extends Error { constructor(status, ...args) { @@ -73,8 +75,6 @@ const tmpDirectory = os.tmpdir(); * do a requested import */ const doImport = async (req, res, padId) => { - const apiLogger = log4js.getLogger('ImportHandler'); - // pipe to a file // convert file to html via abiword or soffice // set html in the pad @@ -161,7 +161,7 @@ const doImport = async (req, res, padId) => { const headCount = _pad.head; if (headCount >= 10) { - apiLogger.warn('Aborting direct database import attempt of a pad that already has content'); + logger.warn('Aborting direct database import attempt of a pad that already has content'); throw new ImportError('padHasData'); } @@ -230,7 +230,7 @@ const doImport = async (req, res, padId) => { try { await importHtml.setPadHTML(pad, text); } catch (e) { - apiLogger.warn('Error importing, possibly caused by malformed HTML'); + logger.warn('Error importing, possibly caused by malformed HTML'); } } else { await pad.setText(text);