mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
ImportHandler: Move the logger up
Also change the name to something shorter.
This commit is contained in:
parent
26b5a69ccc
commit
28b28866a2
1 changed files with 4 additions and 4 deletions
|
@ -33,6 +33,8 @@ const importEtherpad = require('../utils/ImportEtherpad');
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const hooks = require('../../static/js/pluginfw/hooks.js');
|
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`.
|
// `status` must be a string supported by `importErrorMessage()` in `src/static/js/pad_impexp.js`.
|
||||||
class ImportError extends Error {
|
class ImportError extends Error {
|
||||||
constructor(status, ...args) {
|
constructor(status, ...args) {
|
||||||
|
@ -73,8 +75,6 @@ const tmpDirectory = os.tmpdir();
|
||||||
* do a requested import
|
* do a requested import
|
||||||
*/
|
*/
|
||||||
const doImport = async (req, res, padId) => {
|
const doImport = async (req, res, padId) => {
|
||||||
const apiLogger = log4js.getLogger('ImportHandler');
|
|
||||||
|
|
||||||
// pipe to a file
|
// pipe to a file
|
||||||
// convert file to html via abiword or soffice
|
// convert file to html via abiword or soffice
|
||||||
// set html in the pad
|
// set html in the pad
|
||||||
|
@ -161,7 +161,7 @@ const doImport = async (req, res, padId) => {
|
||||||
const headCount = _pad.head;
|
const headCount = _pad.head;
|
||||||
|
|
||||||
if (headCount >= 10) {
|
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');
|
throw new ImportError('padHasData');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ const doImport = async (req, res, padId) => {
|
||||||
try {
|
try {
|
||||||
await importHtml.setPadHTML(pad, text);
|
await importHtml.setPadHTML(pad, text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
apiLogger.warn('Error importing, possibly caused by malformed HTML');
|
logger.warn('Error importing, possibly caused by malformed HTML');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await pad.setText(text);
|
await pad.setText(text);
|
||||||
|
|
Loading…
Reference in a new issue