diff --git a/packages/superdoc/src/core/SuperDoc.js b/packages/superdoc/src/core/SuperDoc.js index b0e57bf209..5342d8641c 100644 --- a/packages/superdoc/src/core/SuperDoc.js +++ b/packages/superdoc/src/core/SuperDoc.js @@ -211,7 +211,7 @@ export class SuperDoc extends EventEmitter { // @ts-ignore this.version = __APP_VERSION__; - console.debug('πŸ¦‹ [superdoc] Using SuperDoc version:', this.version); + this.#log('πŸ¦‹ [superdoc] Using SuperDoc version:', this.version); this.superdocId = config.superdocId || uuidv4(); this.colors = this.config.colors; @@ -478,8 +478,8 @@ export class SuperDoc extends EventEmitter { this.emit('sidebar-toggle', isOpened); } - log(...args) { - console.debug('πŸ¦‹ πŸ¦Έβ€β™€οΈ [superdoc]', ...args); + #log(...args) { + (console.debug ? console.debug : console.log)('πŸ¦‹ πŸ¦Έβ€β™€οΈ [superdoc]', ...args); } /** @@ -558,7 +558,7 @@ export class SuperDoc extends EventEmitter { */ addCommentsList(element) { if (!this.config?.modules?.comments || this.config.role === 'viewer') return; - console.debug('πŸ¦‹ [superdoc] Adding comments list to:', element); + this.#log('πŸ¦‹ [superdoc] Adding comments list to:', element); if (element) this.config.modules.comments.element = element; this.commentsList = new SuperComments(this.config.modules?.comments, this); if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true }); @@ -718,7 +718,7 @@ export class SuperDoc extends EventEmitter { lockSuperdoc(isLocked = false, lockedBy) { this.isLocked = isLocked; this.lockedBy = lockedBy; - console.debug('πŸ¦‹ [superdoc] Locking superdoc:', isLocked, lockedBy, '\n\n\n'); + this.#log('πŸ¦‹ [superdoc] Locking superdoc:', isLocked, lockedBy, '\n\n\n'); this.emit('locked', { isLocked, lockedBy }); } @@ -801,7 +801,7 @@ export class SuperDoc extends EventEmitter { * @returns {Promise} Resolves when all documents have saved */ async #triggerCollaborationSaves() { - console.debug('πŸ¦‹ [superdoc] Triggering collaboration saves'); + this.#log('πŸ¦‹ [superdoc] Triggering collaboration saves'); return new Promise((resolve, reject) => { this.superdocStore.documents.forEach((doc) => { this.pendingCollaborationSaves = 0; @@ -832,9 +832,9 @@ export class SuperDoc extends EventEmitter { // this.exportEditorsToDOCX(), ]; - console.debug('πŸ¦‹ [superdoc] Saving superdoc'); + this.#log('πŸ¦‹ [superdoc] Saving superdoc'); const result = await Promise.all(savePromises); - console.debug('πŸ¦‹ [superdoc] Save complete:', result); + this.#log('πŸ¦‹ [superdoc] Save complete:', result); return result; } @@ -847,7 +847,7 @@ export class SuperDoc extends EventEmitter { return; } - this.log('[superdoc] Unmounting app'); + this.#log('[superdoc] Unmounting app'); this.config.socket?.cancelWebsocketRetry(); this.config.socket?.disconnect();