From 90ce03fb5781cef8ec986a0c34e8b7a5f5ca565c Mon Sep 17 00:00:00 2001 From: emoen Date: Mon, 15 Feb 2016 14:20:51 +0100 Subject: [PATCH] test for window.console and use console.warn instead of console.log --- src/script/widgets/Viewer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/script/widgets/Viewer.js b/src/script/widgets/Viewer.js index f7fb3b3a..28e7ca27 100644 --- a/src/script/widgets/Viewer.js +++ b/src/script/widgets/Viewer.js @@ -724,13 +724,15 @@ gxp.Viewer = Ext.extend(Ext.util.Observable, { var sources = {}; this.mapPanel.layers.each(function(record){ var layer = record.getLayer(); - if (layer.displayInLayerSwitcher ) { + if ( layer.displayInLayerSwitcher ) { var id = record.get("source"); var source = this.layerSources[id]; if (!source) { // Either the layer has no source (id=null) or this layer has a layerSources which isnt defined - console.log("Could not find source type (e.g gxp_wmssource) for layer '" + layer.name + "' and layer id '" + layer.id + "'."); - console.log("Please provide a plugin source if the layer should be included in getState()"); + // Provide a plugin source if the layer should be included in getState() + if (window.console) { + console.warn("Could not find source type (e.g gxp_wmssource) for layer '" + layer.name + "' and layer id '" + layer.id + "'."); + } } else { // add layer state.map.layers.push(source.getConfigForRecord(record));