From 9436742b6094f51db8175c570dbc18212f8b34a3 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sat, 17 Aug 2024 11:36:56 -0700 Subject: [PATCH] Make checker for grafana happy by not calling console.log() --- src/components/CubismPanelHelper.ts | 4 ++-- src/misc_utils.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/CubismPanelHelper.ts b/src/components/CubismPanelHelper.ts index 2917d25..968c4ba 100644 --- a/src/components/CubismPanelHelper.ts +++ b/src/components/CubismPanelHelper.ts @@ -214,13 +214,13 @@ export const zoomCallbackGen = ( ): cubism.zoomCallback => { const f = (start: number, end: number, selection: cubism.d3Selection) => { if (options.links.length === 0) { - console.log("Can't do any zoom, there is no links to zoom to"); + log_debug("Can't do any zoom, there is no links to zoom to"); return; } log_debug(`Doing a zoom from point ${start} to point ${end}`); if (options.links.length > 1) { - console.log('There is more than one link, linked to this graph, will pick the first one'); + log_debug('There is more than one link, linked to this graph, will pick the first one'); } let link = options.links[0].url; isString(link); diff --git a/src/misc_utils.ts b/src/misc_utils.ts index 272e3d9..261bb6d 100644 --- a/src/misc_utils.ts +++ b/src/misc_utils.ts @@ -5,10 +5,11 @@ export function enableDebug(): void { export function log_debug(message?: any, ...optionalParams: any[]): void { // Set it to true to enable debugging if (debug) { + let destination = console; if (optionalParams.length > 0) { - return console.log(message, optionalParams.join(' ')); + return destination.log(message, optionalParams.join(' ')); } else { - return console.log(message); + return destination.log(message); } } }