소스 검색

Fix debug logging of stanzas

JC Brand 1 년 전
부모
커밋
2e27243277
2개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      src/headless/shared/connection/index.js
  2. 2 0
      src/headless/types/shared/connection/index.d.ts

+ 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>;
     /**