From 154b295ecc8591fe5c5263d72f97362add25457b Mon Sep 17 00:00:00 2001
From: Tamara Steinwender <tamara.steinwender@tugraz.at>
Date: Wed, 17 Feb 2021 13:02:37 +0100
Subject: [PATCH] Change provider debug output from console.log to
 console.debug

---
 packages/file-handling/src/file-source.js    |  2 +-
 packages/provider/src/adapter-lit-element.js | 40 ++++++++++----------
 packages/provider/src/adapter.js             | 20 +++++-----
 packages/provider/src/dbp-provider-demo.js   | 10 ++---
 packages/provider/src/provider.js            | 16 ++++----
 5 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/packages/file-handling/src/file-source.js b/packages/file-handling/src/file-source.js
index 63e6e228..a9b4c24e 100644
--- a/packages/file-handling/src/file-source.js
+++ b/packages/file-handling/src/file-source.js
@@ -386,7 +386,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
             this.nextcloudPath = this.initialFileHandlingState.path;
             if (this._('#nextcloud-file-picker').webDavClient !== null) {
                 this._('#nextcloud-file-picker').loadDirectory(this.initialFileHandlingState.path);
-                console.log("load default nextcloud source", this.initialFileHandlingState.target);
+                //console.log("load default nextcloud source", this.initialFileHandlingState.target);
             }
             this.firstOpen = false;
         }
diff --git a/packages/provider/src/adapter-lit-element.js b/packages/provider/src/adapter-lit-element.js
index 864cf99f..206b8a97 100644
--- a/packages/provider/src/adapter-lit-element.js
+++ b/packages/provider/src/adapter-lit-element.js
@@ -23,7 +23,7 @@ export class AdapterLitElement extends LitElement {
         // We need to store our own "last values" because we cannot be sure what the MutationObserver detects
         this.lastProperties = {};
 
-        console.log('AdapterLitElement(' + this.tagName + ') constructor()');
+        console.debug('AdapterLitElement(' + this.tagName + ') constructor()');
     }
 
     getProperty(name) {
@@ -41,7 +41,7 @@ export class AdapterLitElement extends LitElement {
     setProperty(name, value) {
         // TODO: check if lit attribute really present?
         if (typeof value === 'object' && value !== null) {
-            // console.log("value is object", value);
+            // console.debug("value is object", value);
             this.setPropertyByAttributeName(name, value);
         } else {
             this.attributeChangedCallback(name, this.getPropertyByAttributeName(name), value);
@@ -83,7 +83,7 @@ export class AdapterLitElement extends LitElement {
         this.addEventListener('dbp-subscribe', function (e) {
             const name = e.detail.name;
             if (that.hasProperty(name) || that.root) {
-                console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-subscribe",..) name "' + name + '" found.');
+                console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-subscribe",..) name "' + name + '" found.');
                 that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender});
 
                 e.detail.callback(that.getProperty(name));
@@ -95,12 +95,12 @@ export class AdapterLitElement extends LitElement {
             const name = e.detail.name;
             const sender = e.detail.sender;
             if (that.hasProperty(name) || that.root) {
-                console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.');
+                console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.');
                 that.callbackStore.forEach(item => {
                     if (item.sender === sender && item.name === name) {
                         const index = that.callbackStore.indexOf(item);
                         that.callbackStore.splice(index, 1);
-                        console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener for name "' + name + '" removed.');
+                        console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener for name "' + name + '" removed.');
                     }
                 });
 
@@ -114,7 +114,7 @@ export class AdapterLitElement extends LitElement {
             const value = e.detail.value;
 
             if (that.hasProperty(name) || that.root) {
-                console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-set-property",..) name "' + name + '" found.');
+                console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-set-property",..) name "' + name + '" found.');
                 that.setProperty(name, value);
 
                 that.callbackStore.forEach(item => {
@@ -139,7 +139,7 @@ export class AdapterLitElement extends LitElement {
                     const value = that.getAttribute(name);
 
                     if (that.hasPropertyChanged(name, value)) {
-                        console.log('AdapterLitElementProvider (' + that.tagName + ') observed attribute "' + name + '" changed');
+                        console.debug('AdapterLitElementProvider (' + that.tagName + ') observed attribute "' + name + '" changed');
                         that.setProperty(name, value);
 
                         that.callbackStore.forEach(item => {
@@ -167,7 +167,7 @@ export class AdapterLitElement extends LitElement {
                 }
 
                 this.setProperty(attrs[i].name, attrs[i].value);
-                console.log('AdapterLitElementProvider (' + that.tagName + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
+                console.debug('AdapterLitElementProvider (' + that.tagName + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
             }
         }
     }
@@ -180,7 +180,7 @@ export class AdapterLitElement extends LitElement {
     }
 
     subscribeProviderFor(element) {
-        console.log('AdapterLitElement(' + this.tagName + ') subscribeProviderFor( ' + element + ' )');
+        console.debug('AdapterLitElement(' + this.tagName + ') subscribeProviderFor( ' + element + ' )');
         const pair = element.trim().split(':');
         const local = pair[0];
         const global = pair[1] || local;
@@ -192,14 +192,14 @@ export class AdapterLitElement extends LitElement {
                 detail: {
                     name: global,
                     callback: (value) => {
-                        console.log('AdapterLitElement(' + that.tagName + ') sub/Callback ' + global + ' -> ' + local + ' = ' + value);
+                        console.debug('AdapterLitElement(' + that.tagName + ') sub/Callback ' + global + ' -> ' + local + ' = ' + value);
 
                         // If value is an object set it directly as property
                         if (typeof value === 'object' && value !== null) {
-                            // console.log("value is object", value);
+                            // console.debug("value is object", value);
                             that.setPropertyByAttributeName(local, value);
                         } else {
-                            // console.log("local, that.getPropertyByAttributeName(local), value", local, that.getPropertyByAttributeName(local), value);
+                            // console.debug("local, that.getPropertyByAttributeName(local), value", local, that.getPropertyByAttributeName(local), value);
                             that.attributeChangedCallback(local, that.getPropertyByAttributeName(local), value);
 
                             // check if an attribute also exists in the tag
@@ -221,7 +221,7 @@ export class AdapterLitElement extends LitElement {
     }
 
     unSubscribeProviderFor(element) {
-        console.log('AdapterLitElement(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )');
+        console.debug('AdapterLitElement(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )');
         const pair = element.trim().split(':');
         const global = pair[1] || pair[0];
         const event = new CustomEvent('dbp-unsubscribe',
@@ -246,10 +246,10 @@ export class AdapterLitElement extends LitElement {
     findPropertyName(attributeName) {
         let resultName = attributeName;
         const properties = this.constructor.properties;
-        // console.log("properties", properties);
+        // console.debug("properties", properties);
 
         for (const propertyName in properties) {
-            // console.log("findPropertyName", `${propertyName}: ${properties[propertyName]}`);
+            // console.debug("findPropertyName", `${propertyName}: ${properties[propertyName]}`);
             const attribute = properties[propertyName].attribute;
             if (attribute === attributeName) {
                 resultName = propertyName;
@@ -263,7 +263,7 @@ export class AdapterLitElement extends LitElement {
     attributeChangedCallback(name, oldValue, newValue) {
         switch(name) {
             case 'subscribe':
-                console.log('AdapterLitElement() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
+                console.debug('AdapterLitElement() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
 
                 if (this.subscribe && this.subscribe.length > 0) {
                     if (this.connected) {
@@ -291,12 +291,12 @@ export class AdapterLitElement extends LitElement {
                 if (newValue || !oldValue || !name) {
                     super.attributeChangedCallback(name, oldValue, newValue);
                 // } else {
-                    //     console.log("attributeChangedCallback ignored", name, oldValue, newValue);
+                    //     console.debug("attributeChangedCallback ignored", name, oldValue, newValue);
                 }
         }
 
-        // console.log("this.lang", this.tagName, name, this.lang);
-        // console.log("this.entryPointUrl", this.tagName, name, this.entryPointUrl);
+        // console.debug("this.lang", this.tagName, name, this.lang);
+        // console.debug("this.entryPointUrl", this.tagName, name, this.entryPointUrl);
         // console.trace();
     }
 
@@ -308,7 +308,7 @@ export class AdapterLitElement extends LitElement {
      * @returns {boolean}
      */
     sendSetPropertyEvent(name, value) {
-        // console.log("dbp-set-property", name, value);
+        // console.debug("dbp-set-property", name, value);
 
         const event = new CustomEvent('dbp-set-property', {
             bubbles: true,
diff --git a/packages/provider/src/adapter.js b/packages/provider/src/adapter.js
index 6d5dec72..f0842fa9 100644
--- a/packages/provider/src/adapter.js
+++ b/packages/provider/src/adapter.js
@@ -11,7 +11,7 @@ export class Adapter extends HTMLElement {
         this.subscribe = '';
         this.unsubscribe = '';
 
-        console.log('Adapter constructor()');
+        console.debug('Adapter constructor()');
     }
 
     getPropertyByAttributeName(name) {
@@ -40,7 +40,7 @@ export class Adapter extends HTMLElement {
 
                 this.attributeChangedCallback(attrs[i].name, this.getPropertyByAttributeName(attrs[i].name), attrs[i].value);
 
-                console.log('AdapterProvider (' + that.tagName + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
+                console.debug('AdapterProvider (' + that.tagName + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
             }
         }
     }
@@ -51,7 +51,7 @@ export class Adapter extends HTMLElement {
     }
 
     subscribeProviderFor(element) {
-        console.log('AdapterProvider(' + this.tagName + ') subscribeProviderFor( ' + element + ' )');
+        console.debug('AdapterProvider(' + this.tagName + ') subscribeProviderFor( ' + element + ' )');
         const pair = element.trim().split(':');
         const local = pair[0];
         const global = pair[1] || local;
@@ -63,15 +63,15 @@ export class Adapter extends HTMLElement {
                 detail: {
                     name: global,
                     callback: (value) => {
-                        console.log('AdapterProvider(' + that.tagName + ') sub/Callback ' + global + ' -> ' + local + ' = ' + value);
+                        console.debug('AdapterProvider(' + that.tagName + ') sub/Callback ' + global + ' -> ' + local + ' = ' + value);
                         that.setPropertiesToChildNodes(local, value);
 
                         // If value is an object set it directly as property
                         if (typeof value === 'object' && value !== null) {
-                            // console.log("value is object", value);
+                            // console.debug("value is object", value);
                             that.setPropertyByAttributeName(local, value);
                         } else {
-                            // console.log("local, that.getPropertyByAttributeName(local), value", local, that.getPropertyByAttributeName(local), value);
+                            // console.debug("local, that.getPropertyByAttributeName(local), value", local, that.getPropertyByAttributeName(local), value);
                             that.attributeChangedCallback(local, that.getPropertyByAttributeName(local), value);
 
                             // check if an attribute also exists in the tag
@@ -93,7 +93,7 @@ export class Adapter extends HTMLElement {
     }
 
     unSubscribeProviderFor(element) {
-        console.log('AdapterProvider(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )');
+        console.debug('AdapterProvider(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )');
         const pair = element.trim().split(':');
         const global = pair[1] || pair[0];
         const event = new CustomEvent('dbp-unsubscribe',
@@ -118,10 +118,10 @@ export class Adapter extends HTMLElement {
     findPropertyName(attributeName) {
         let resultName = attributeName;
         const properties = this.constructor.properties;
-        // console.log("properties", properties);
+        // console.debug("properties", properties);
 
         for (const propertyName in properties) {
-            // console.log("findPropertyName", `${propertyName}: ${properties[propertyName]}`);
+            // console.debug("findPropertyName", `${propertyName}: ${properties[propertyName]}`);
             const attribute = properties[propertyName].attribute;
             if (attribute === attributeName) {
                 resultName = propertyName;
@@ -135,7 +135,7 @@ export class Adapter extends HTMLElement {
     attributeChangedCallback(name, oldValue, newValue) {
         switch(name) {
             case 'subscribe':
-                console.log('AdapterProvider() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
+                console.debug('AdapterProvider() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
 
                 if (this.subscribe && this.subscribe.length > 0) {
                     if (this.connected) {
diff --git a/packages/provider/src/dbp-provider-demo.js b/packages/provider/src/dbp-provider-demo.js
index 0fd78e06..c47ca185 100644
--- a/packages/provider/src/dbp-provider-demo.js
+++ b/packages/provider/src/dbp-provider-demo.js
@@ -42,7 +42,7 @@ class ProviderDemo extends ScopedElementsMixin(DBPLitElement) {
     }
 
     attributeChangedCallback(name, oldValue, newValue) {
-        console.log('ProviderDemo (' + this.id + ') attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
+        console.debug('ProviderDemo (' + this.id + ') attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
         switch(name) {
             case 'lang':
                 this.lang = newValue;
@@ -152,13 +152,13 @@ class DemoConsumer extends DBPLitElement {
 
         this.status = 'local';
 
-        console.log('DemoConsumer constructor()');
+        console.debug('DemoConsumer constructor()');
     }
 
     connectedCallback() {
         super.connectedCallback();
         i18n.changeLanguage(this.lang);
-        console.log('DemoConsumer(' + this.id + ') connectedCallback()');
+        console.debug('DemoConsumer(' + this.id + ') connectedCallback()');
         this.render();
     }
 
@@ -180,7 +180,7 @@ class DemoConsumer extends DBPLitElement {
             return;
         }
 
-        console.log('DemoConsumer(' + this.id + ') attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
+        console.debug('DemoConsumer(' + this.id + ') attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
         switch(name) {
             case 'lang':
                 this.lang = newValue;
@@ -212,7 +212,7 @@ class DemoConsumer extends DBPLitElement {
         if (! this.connected) {
             return `not connected!`;
         }
-        console.log('DemoConsumer(' + this.id + ') render()');
+        console.debug('DemoConsumer(' + this.id + ') render()');
 
         const sum = this.foo + this.bar;
         return html`
diff --git a/packages/provider/src/provider.js b/packages/provider/src/provider.js
index 26e885f2..f92c2d51 100644
--- a/packages/provider/src/provider.js
+++ b/packages/provider/src/provider.js
@@ -12,7 +12,7 @@ export class Provider extends HTMLElement {
         // We need to store our own "last values" because we cannot be sure what the MutationObserver detects
         this.lastProperties = {};
 
-        console.log('Provider constructor()');
+        console.debug('Provider constructor()');
     }
 
     getProperty(name) {
@@ -33,14 +33,14 @@ export class Provider extends HTMLElement {
     }
 
     connectedCallback() {
-        console.log('Provider(' + this.id + ') connectedCallback()');
+        console.debug('Provider(' + this.id + ') connectedCallback()');
 
         const that = this;
 
         this.addEventListener('dbp-subscribe', function (e) {
             const name = e.detail.name;
             if (that.hasProperty(name) || that.root) {
-                console.log('Provider(' + that.id + ') eventListener("dbp-subscribe",..) name "' + name + '" found.');
+                console.debug('Provider(' + that.id + ') eventListener("dbp-subscribe",..) name "' + name + '" found.');
                 that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender});
 
                 e.detail.callback(that.getProperty(name));
@@ -52,12 +52,12 @@ export class Provider extends HTMLElement {
             const name = e.detail.name;
             const sender = e.detail.sender;
             if (that.hasProperty(name) || that.root) {
-                console.log('Provider(' + that.id + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.');
+                console.debug('Provider(' + that.id + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.');
                 that.callbackStore.forEach(item => {
                     if (item.sender === sender && item.name === name) {
                         const index = that.callbackStore.indexOf(item);
                         that.callbackStore.splice(index, 1);
-                        console.log('Provider(' + that.id + ') eventListener for name "' + name + '" removed.');
+                        console.debug('Provider(' + that.id + ') eventListener for name "' + name + '" removed.');
                     }
                 });
 
@@ -71,7 +71,7 @@ export class Provider extends HTMLElement {
             const value = e.detail.value;
 
             if (that.hasProperty(name) || that.root) {
-                console.log('Provider(' + that.id + ') eventListener("dbp-set-property",..) name "' + name + '" found.');
+                console.debug('Provider(' + that.id + ') eventListener("dbp-set-property",..) name "' + name + '" found.');
                 that.setProperty(name, value);
 
                 that.callbackStore.forEach(item => {
@@ -96,7 +96,7 @@ export class Provider extends HTMLElement {
                     const value = that.getAttribute(name);
 
                     if (that.hasPropertyChanged(name, value)) {
-                        console.log('Provider (' + that.id + ') observed attribute "' + name + '" changed');
+                        console.debug('Provider (' + that.id + ') observed attribute "' + name + '" changed');
                         that.setProperty(name, value);
 
                         that.callbackStore.forEach(item => {
@@ -124,7 +124,7 @@ export class Provider extends HTMLElement {
                 }
 
                 this.setProperty(attrs[i].name, attrs[i].value);
-                console.log('Provider (' + that.id + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
+                console.debug('Provider (' + that.id + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
             }
         }
     }
-- 
GitLab