2
0
Эх сурвалжийг харах

Fix debug logging of stanzas

JC Brand 1 жил өмнө
parent
commit
2e27243277

+ 10 - 1
src/headless/shared/connection/index.js

@@ -30,6 +30,16 @@ export class Connection extends Strophe.Connection {
         this.debouncedReconnect = debounce(this.reconnect, 3000);
     }
 
+    /** @param {Element} body */
+    xmlInput (body) {
+        log.debug(body.outerHTML, 'color: darkgoldenrod');
+    }
+
+    /** @param {Element} body */
+    xmlOutput (body) {
+        log.debug(body.outerHTML, 'color: darkcyan');
+    }
+
     async bind () {
         const { api } = _converse;
         /**
@@ -41,7 +51,6 @@ export class Connection extends Strophe.Connection {
         super.bind();
     }
 
-
     async onDomainDiscovered (response) {
         const { api } = _converse;
         const text = await response.text();

+ 2 - 0
src/headless/types/shared/connection/index.d.ts

@@ -8,6 +8,8 @@ export class Connection extends Connection_base {
     constructor(service: any, options: any);
     send_initial_presence: boolean;
     debouncedReconnect: any;
+    /** @param {Element} body */
+    xmlInput(body: Element): void;
     bind(): Promise<void>;
     onDomainDiscovered(response: any): Promise<void>;
     /**