From 75f3c58543432609049ffd0c4c3cbe917bb7a3ca Mon Sep 17 00:00:00 2001 From: Martin Karkowski Date: Fri, 19 Mar 2021 13:19:06 +0100 Subject: [PATCH] Trying to fix - Bridge --- lib/communication/bridge.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/communication/bridge.ts b/lib/communication/bridge.ts index c26bc2b..5b129c3 100644 --- a/lib/communication/bridge.ts +++ b/lib/communication/bridge.ts @@ -264,7 +264,18 @@ export class Bridge implements ICommunicationInterface { ): void { const oldItems = this._combineLayers(layerToForwardTo, mode); // Store the Elements, that have been provided before. - this._dispatcherSubscribedTopicsMapping.set(dispatcherID, new Set(content)); + switch (mode) { + case "events": + this._dispatcherSubscribedTopicsMapping.set( + dispatcherID, + new Set(content) + ); + break; + case "services": + this._dispatcherServicesMapping.set(dispatcherID, new Set(content)); + break; + } + // Store the Elements, that now have been provided. const newItems = this._combineLayers(layerToForwardTo, mode); @@ -371,6 +382,15 @@ export class Bridge implements ICommunicationInterface { if (!this._callbacks.has(_name)) { // Define the Callback and Store it. const callback = (msg) => { + if (this._logger) { + this._logger.debug( + layerSubscribed.id, + "==", + _mapping[type], + "==>", + layerForwarded.id + ); + } layerForwarded[_mapping[type]](item, msg); }; this._callbacks.set(_name, { @@ -619,8 +639,8 @@ export class Bridge implements ICommunicationInterface { } else { // Define a Function which stores the Actions: this[method as any] = async (...args) => { - if (_this._logger) { - _this._logger.debug(method, ...args); + if (_this._logger && method !== "emitStatusUpdate") { + _this._logger.info(method, ...args); } for (const _layer of _this._connectedLayers.keys()) { @@ -643,7 +663,7 @@ export class Bridge implements ICommunicationInterface { const _wrapped = (data) => { // Log the Forwarding if (_this._logger && method != "onStatusUpdate") { - _this._logger.debug("Forwarding", method, "=>", METHOD_MAPPING[method]); + _this._logger.info("Forwarding", method, "=>", METHOD_MAPPING[method]); } for (const _layer of _this._connectedLayers.keys()) { @@ -668,7 +688,7 @@ export class Bridge implements ICommunicationInterface { const _this = this; return (data) => { if (_this._logger && method != "onStatusUpdate") { - _this._logger.debug("Forwarding", method, "=>", METHOD_MAPPING[method]); + _this._logger.info("Forwarding", method, "=>", METHOD_MAPPING[method]); } for (const _layer of _this._connectedLayers.keys()) {