From 6a59ecfa474f3f0a4881fd46bd1d97b3d6c0786c Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 16 Oct 2025 22:12:56 +0200 Subject: [PATCH] debug: prefix all bunker logs with [bunker] for easy filtering - Update App.tsx reconnection logs - Update highlightCreationService signing logs - Update LoginOptions error logs - Makes it easy to filter console with 'bunker' keyword --- src/App.tsx | 20 ++++++++++---------- src/components/LoginOptions.tsx | 2 +- src/services/highlightCreationService.ts | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index b9d7bd73..92c9c809 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -223,7 +223,7 @@ function App() { // Reconnect bunker signers when active account changes const bunkerReconnectSub = accounts.active$.subscribe(async (account) => { - console.log('👤 Active account changed:', { + console.log('[bunker] Active account changed:', { hasAccount: !!account, type: account?.type, id: account?.id @@ -231,7 +231,7 @@ function App() { if (account && account.type === 'nostr-connect') { const nostrConnectAccount = account as Accounts.NostrConnectAccount - console.log('🔐 Bunker account detected. Status:', { + console.log('[bunker] Account detected. Status:', { listening: nostrConnectAccount.signer.listening, isConnected: nostrConnectAccount.signer.isConnected, hasRemote: !!nostrConnectAccount.signer.remote @@ -240,25 +240,25 @@ function App() { try { // Ensure the signer is listening for responses if (!nostrConnectAccount.signer.listening) { - console.log('🔐 Opening bunker signer subscription...') + console.log('[bunker] Opening signer subscription...') await nostrConnectAccount.signer.open() - console.log('✅ Bunker signer subscription opened') + console.log('[bunker] ✅ Signer subscription opened') } else { - console.log('✅ Bunker signer already listening') + console.log('[bunker] ✅ Signer already listening') } // Reconnect with permissions if not already connected if (!nostrConnectAccount.signer.isConnected) { - console.log('🔐 Reconnecting bunker signer with permissions...') + console.log('[bunker] Reconnecting with permissions...') const permissions = getDefaultBunkerPermissions() - console.log('🔐 Permissions:', permissions) + console.log('[bunker] Permissions:', permissions) await nostrConnectAccount.signer.connect(undefined, permissions) - console.log('✅ Bunker signer reconnected successfully') + console.log('[bunker] ✅ Reconnected successfully') } else { - console.log('✅ Bunker signer already connected') + console.log('[bunker] ✅ Already connected') } } catch (error) { - console.error('❌ Failed to reconnect bunker signer:', error) + console.error('[bunker] ❌ Failed to reconnect:', error) } } }) diff --git a/src/components/LoginOptions.tsx b/src/components/LoginOptions.tsx index 3df6739b..bb18501b 100644 --- a/src/components/LoginOptions.tsx +++ b/src/components/LoginOptions.tsx @@ -59,7 +59,7 @@ const LoginOptions: React.FC = () => { setBunkerUri('') setShowBunkerInput(false) } catch (err) { - console.error('Bunker login failed:', err) + console.error('[bunker] Login failed:', err) const errorMessage = err instanceof Error ? err.message : 'Failed to connect to bunker' // Check for permission-related errors diff --git a/src/services/highlightCreationService.ts b/src/services/highlightCreationService.ts index 5f19c3e6..b9cb7960 100644 --- a/src/services/highlightCreationService.ts +++ b/src/services/highlightCreationService.ts @@ -116,9 +116,9 @@ export async function createHighlight( } // Sign the event - console.log('🖊️ Signing highlight event...', { kind: highlightEvent.kind, tags: highlightEvent.tags.length }) + console.log('[bunker] Signing highlight event...', { kind: highlightEvent.kind, tags: highlightEvent.tags.length }) const signedEvent = await factory.sign(highlightEvent) - console.log('✅ Highlight signed successfully!', { id: signedEvent.id.slice(0, 8) }) + console.log('[bunker] ✅ Highlight signed successfully!', { id: signedEvent.id.slice(0, 8) }) // Use unified write service to store and publish await publishEvent(relayPool, eventStore, signedEvent)