From 4fc628eceff68fc1a589574e7d93790a8343ae08 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Mon, 6 Jan 2025 22:25:51 +0000 Subject: [PATCH] Add more logs --- plugin/src/events/obisidan-event-handler.ts | 4 ++++ plugin/src/file-operations/obsidian-file-operations.ts | 10 +++++++++- plugin/src/services/sync-service.ts | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugin/src/events/obisidan-event-handler.ts b/plugin/src/events/obisidan-event-handler.ts index 2eae62ff..0d4461fc 100644 --- a/plugin/src/events/obisidan-event-handler.ts +++ b/plugin/src/events/obisidan-event-handler.ts @@ -50,6 +50,10 @@ export class ObsidianFileEventHandler implements FileEventHandler { public async onModify(file: TAbstractFile): Promise { if (file instanceof TFile) { + if (file.basename.startsWith("console-log.iPhone")) { + return; + } + Logger.getInstance().info(`File modified: ${file.path}`); await this.syncer.syncLocallyUpdatedFile({ diff --git a/plugin/src/file-operations/obsidian-file-operations.ts b/plugin/src/file-operations/obsidian-file-operations.ts index 6a82006f..6353079f 100644 --- a/plugin/src/file-operations/obsidian-file-operations.ts +++ b/plugin/src/file-operations/obsidian-file-operations.ts @@ -8,21 +8,29 @@ export class ObsidianFileOperations implements FileOperations { public constructor(private readonly vault: Vault) {} public async listAllFiles(): Promise { + console.log("before getFiles"); const files = this.vault.getFiles(); + console.log("after getFiles"); + console.log(files); return files.map((file) => file.path); } public async read(path: RelativePath): Promise { - return new Uint8Array( + console.log("before readBinary"); + const result = new Uint8Array( await this.vault.adapter.readBinary(normalizePath(path)) ); + console.log("after readBinary"); + return result; } public async getModificationTime(path: RelativePath): Promise { + console.log("before stat"); const file = await this.vault.adapter.stat(normalizePath(path)); if (!file) { throw new Error(`File not found: ${path}`); } + console.log("after stat"); return new Date(file.mtime); } diff --git a/plugin/src/services/sync-service.ts b/plugin/src/services/sync-service.ts index d9c34109..fdda9322 100644 --- a/plugin/src/services/sync-service.ts +++ b/plugin/src/services/sync-service.ts @@ -98,7 +98,7 @@ export class SyncService { Logger.getInstance().debug( `Created document ${JSON.stringify( - response.data.relativePath + response.data )} with id ${response.data.documentId}` ); @@ -146,7 +146,7 @@ export class SyncService { } Logger.getInstance().debug( - `Updated document ${response.data.relativePath} with id ${response.data.documentId}` + `Updated document ${JSON.stringify(response.data)} with id ${response.data.documentId}` ); return response.data;