From 24836f7a89c9f5797749a51cce569ea3638dea23 Mon Sep 17 00:00:00 2001 From: Nicolas ANGOT Date: Mon, 11 Nov 2019 17:12:38 +0100 Subject: [PATCH] fix logger reference (#3103) --- src/streaming/metrics/metrics/MetricsHandlerFactory.js | 4 ++-- src/streaming/metrics/reporting/ReportingFactory.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/streaming/metrics/metrics/MetricsHandlerFactory.js b/src/streaming/metrics/metrics/MetricsHandlerFactory.js index 26c43f6436..85a423cf04 100644 --- a/src/streaming/metrics/metrics/MetricsHandlerFactory.js +++ b/src/streaming/metrics/metrics/MetricsHandlerFactory.js @@ -38,7 +38,7 @@ function MetricsHandlerFactory(config) { config = config || {}; let instance; - const debug = config.debug; + const logger = config.debug ? config.debug.getLogger(instance) : {}; // group 1: key, [group 3: n [, group 5: type]] let keyRegex = /([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/; @@ -75,7 +75,7 @@ function MetricsHandlerFactory(config) { ); } catch (e) { handler = null; - debug.error(`MetricsHandlerFactory: Could not create handler for type ${matches[1]} with args ${matches[3]}, ${matches[5]} (${e.message})`); + logger.error(`MetricsHandlerFactory: Could not create handler for type ${matches[1]} with args ${matches[3]}, ${matches[5]} (${e.message})`); } return handler; diff --git a/src/streaming/metrics/reporting/ReportingFactory.js b/src/streaming/metrics/reporting/ReportingFactory.js index bbc6633a95..8fe9948deb 100644 --- a/src/streaming/metrics/reporting/ReportingFactory.js +++ b/src/streaming/metrics/reporting/ReportingFactory.js @@ -39,10 +39,9 @@ function ReportingFactory(config) { }; const context = this.context; - const debug = config.debug; - const metricsConstants = config.metricsConstants; - let instance; + const logger = config.debug ? config.debug.getLogger(instance) : {}; + const metricsConstants = config.metricsConstants; function create(entry, rangeController) { let reporting; @@ -55,7 +54,7 @@ function ReportingFactory(config) { reporting.initialize(entry, rangeController); } catch (e) { reporting = null; - debug.error(`ReportingFactory: could not create Reporting with schemeIdUri ${entry.schemeIdUri} (${e.message})`); + logger.error(`ReportingFactory: could not create Reporting with schemeIdUri ${entry.schemeIdUri} (${e.message})`); } return reporting;