Skip to content

Commit dcf6d92

Browse files
refactor: add fallback logging for init routine
1 parent e040d05 commit dcf6d92

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

packages/superdoc/src/core/SuperDoc.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class SuperDoc extends EventEmitter {
211211

212212
// @ts-ignore
213213
this.version = __APP_VERSION__;
214-
console.debug('🦋 [superdoc] Using SuperDoc version:', this.version);
214+
this.#log('🦋 [superdoc] Using SuperDoc version:', this.version);
215215

216216
this.superdocId = config.superdocId || uuidv4();
217217
this.colors = this.config.colors;
@@ -478,8 +478,8 @@ export class SuperDoc extends EventEmitter {
478478
this.emit('sidebar-toggle', isOpened);
479479
}
480480

481-
log(...args) {
482-
console.debug('🦋 🦸‍♀️ [superdoc]', ...args);
481+
#log(...args) {
482+
(console.debug ? console.debug : console.log)('🦋 🦸‍♀️ [superdoc]', ...args);
483483
}
484484

485485
/**
@@ -558,7 +558,7 @@ export class SuperDoc extends EventEmitter {
558558
*/
559559
addCommentsList(element) {
560560
if (!this.config?.modules?.comments || this.config.role === 'viewer') return;
561-
console.debug('🦋 [superdoc] Adding comments list to:', element);
561+
this.#log('🦋 [superdoc] Adding comments list to:', element);
562562
if (element) this.config.modules.comments.element = element;
563563
this.commentsList = new SuperComments(this.config.modules?.comments, this);
564564
if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -718,7 +718,7 @@ export class SuperDoc extends EventEmitter {
718718
lockSuperdoc(isLocked = false, lockedBy) {
719719
this.isLocked = isLocked;
720720
this.lockedBy = lockedBy;
721-
console.debug('🦋 [superdoc] Locking superdoc:', isLocked, lockedBy, '\n\n\n');
721+
this.#log('🦋 [superdoc] Locking superdoc:', isLocked, lockedBy, '\n\n\n');
722722
this.emit('locked', { isLocked, lockedBy });
723723
}
724724

@@ -801,7 +801,7 @@ export class SuperDoc extends EventEmitter {
801801
* @returns {Promise<void>} Resolves when all documents have saved
802802
*/
803803
async #triggerCollaborationSaves() {
804-
console.debug('🦋 [superdoc] Triggering collaboration saves');
804+
this.#log('🦋 [superdoc] Triggering collaboration saves');
805805
return new Promise((resolve, reject) => {
806806
this.superdocStore.documents.forEach((doc) => {
807807
this.pendingCollaborationSaves = 0;
@@ -832,9 +832,9 @@ export class SuperDoc extends EventEmitter {
832832
// this.exportEditorsToDOCX(),
833833
];
834834

835-
console.debug('🦋 [superdoc] Saving superdoc');
835+
this.#log('🦋 [superdoc] Saving superdoc');
836836
const result = await Promise.all(savePromises);
837-
console.debug('🦋 [superdoc] Save complete:', result);
837+
this.#log('🦋 [superdoc] Save complete:', result);
838838
return result;
839839
}
840840

@@ -847,7 +847,7 @@ export class SuperDoc extends EventEmitter {
847847
return;
848848
}
849849

850-
this.log('[superdoc] Unmounting app');
850+
this.#log('[superdoc] Unmounting app');
851851

852852
this.config.socket?.cancelWebsocketRetry();
853853
this.config.socket?.disconnect();

0 commit comments

Comments
 (0)