From 1dc021e8714b66fd57bf39caaab42b415e61dd26 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 9 Aug 2018 15:37:04 +0100 Subject: [PATCH] Improve custom context store module logging --- red/runtime/nodes/context/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/red/runtime/nodes/context/index.js b/red/runtime/nodes/context/index.js index 6b5f5803f..da7c4f670 100644 --- a/red/runtime/nodes/context/index.js +++ b/red/runtime/nodes/context/index.js @@ -112,7 +112,15 @@ function load() { try { // Create a new instance of the plugin by calling its module function stores[pluginName] = plugin(config); - log.info(log._("context.log-store-init", {name:pluginName, info:"module="+plugins[pluginName].module})); + var moduleInfo = plugins[pluginName].module; + if (typeof moduleInfo !== 'string') { + if (moduleInfo.hasOwnProperty("toString")) { + moduleInfo = moduleInfo.toString(); + } else { + moduleInfo = "custom"; + } + } + log.info(log._("context.log-store-init", {name:pluginName, info:"module="+moduleInfo})); } catch(err) { return reject(new Error(log._("context.error-loading-module",{module:pluginName,message:err.toString()}))); }