From 693ed736fab46d4f00acc6465da06351c1d4afcb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 8 Apr 2019 21:43:39 +0200 Subject: [PATCH] Improvements to Minio intergration --- MinioBlobStorage.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/MinioBlobStorage.js b/MinioBlobStorage.js index 98b0f0876..41b282a84 100644 --- a/MinioBlobStorage.js +++ b/MinioBlobStorage.js @@ -80,10 +80,6 @@ exports.newMinioBlobBlobStorage = function newMinioBlobBlobStorage(BOT, logger) function createTextFile(pFolderPath, pFileName, pFileContent, callBackFunction) { - if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] createTextFile -> initialize function not executed or failed. Can not process this request. Sorry."); } - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; - try { if (FULL_LOG === true && logger !== undefined) { @@ -110,6 +106,13 @@ exports.newMinioBlobBlobStorage = function newMinioBlobBlobStorage(BOT, logger) logger.write(MODULE_NAME, "[INFO] createTextFile -> onFileReceived -> pFileContent = " + pFileContent); } + /* Console logging */ + console.log(MODULE_NAME, "[INFO] 'createTextFile' -> onFileReceived -> File created at MINIO -> File = " + pFolderPath + "/" + pFileName); + + if (err) { + console.log(MODULE_NAME, "[WARN] 'createTextFile' -> onFileReceived -> File created at MINIO -> err = " + err.message); + } + if (err) { if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileCreated -> err = " + JSON.stringify(err)); } @@ -202,10 +205,6 @@ exports.newMinioBlobBlobStorage = function newMinioBlobBlobStorage(BOT, logger) } function getTextFile(pFolderPath, pFileName, callBackFunction) { - - if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] getTextFile -> initialize function not executed or failed. Can not process this request. Sorry."); } - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; try { @@ -248,6 +247,13 @@ exports.newMinioBlobBlobStorage = function newMinioBlobBlobStorage(BOT, logger) logger.write(MODULE_NAME, "[INFO] getTextFile -> onFileReceived -> text = " + text); } + /* Console logging */ + console.log(MODULE_NAME, "[INFO] 'getTextFile' -> onFileReceived -> File read from MINIO -> File = " + pFolderPath + "/" + pFileName); + + if (err) { + console.log(MODULE_NAME, "[WARN] 'getTextFile' -> onFileReceived -> File read from MINIO -> err = " + err.message); + } + if (err) { if (ERROR_LOG === true && logger !== undefined && err.code !== 'BlobNotFound') {