Browse Source

reduce console noise

imwald
Silberengel 3 weeks ago
parent
commit
04d3829c0e
  1. 4
      src/components/NoteList/index.tsx
  2. 62
      src/lib/error-suppression.ts
  3. 2
      src/lib/index-relay-http.ts
  4. 10
      src/providers/NostrProvider/index.tsx
  5. 2
      src/services/client.service.ts
  6. 8
      src/services/relay-operation-log.service.ts

4
src/components/NoteList/index.tsx

@ -1018,7 +1018,7 @@ const NoteList = forwardRef( @@ -1018,7 +1018,7 @@ const NoteList = forwardRef(
if (feedPaintSessionPendingRef.current) {
feedPaintSessionPendingRef.current = false
logger.info('[FeedPaint] Session cache committed (DOM)', {
logger.debug('[FeedPaint] Session cache committed (DOM)', {
feedKey: feedKeyShort,
snapshotKey: snapshotKeyShort,
eventCount: events.length,
@ -1030,7 +1030,7 @@ const NoteList = forwardRef( @@ -1030,7 +1030,7 @@ const NoteList = forwardRef(
feedPaintRelayPendingRef.current = false
const meta = feedPaintRelayMetaRef.current
feedPaintRelayMetaRef.current = null
logger.info('[FeedPaint] Relay/network results committed (DOM)', {
logger.debug('[FeedPaint] Relay/network results committed (DOM)', {
feedKey: feedKeyShort,
snapshotKey: snapshotKeyShort,
committedEventCount: events.length,

62
src/lib/error-suppression.ts

@ -18,11 +18,14 @@ export function suppressExpectedErrors() { @@ -18,11 +18,14 @@ export function suppressExpectedErrors() {
return
}
// Suppress CORS errors for external websites
// Suppress CORS errors for external websites (EN + DE Firefox strings)
if (message.includes('CORS policy') ||
message.includes('Access-Control-Allow-Origin') ||
message.includes('has been blocked by CORS policy') ||
message.includes('blocked by CORS policy') ||
message.includes('Quellübergreifende') ||
message.includes('Gleiche-Quelle-Regel') ||
message.includes('Cross-Origin') && message.includes('blockiert') ||
(message.includes('Access to fetch at') && message.includes('has been blocked')) ||
(message.includes('from origin') && message.includes('has been blocked'))) {
return
@ -128,7 +131,20 @@ export function suppressExpectedErrors() { @@ -128,7 +131,20 @@ export function suppressExpectedErrors() {
(message.includes('fehlgeschlagen') && message.includes('URI')) ||
message.includes('Laden der Medienressource') ||
message.includes('Failed to load media resource') ||
message.includes('OpaqueResponseBlocking')) {
message.includes('OpaqueResponseBlocking') ||
(message.includes('image/svg+xml') &&
(message.includes('nicht unterstützt') ||
message.includes('Keine Decoder') ||
message.includes('Medien können nicht'))) ||
message.includes('A resource is blocked by OpaqueResponseBlocking')) {
return
}
// Firefox: failed WS to dead local/dev relays (wording varies by locale)
if (
message.includes('kann keine Verbindung') &&
(message.includes('WebSocket') || message.includes('ws://') || message.includes('wss://'))
) {
return
}
@ -158,7 +174,31 @@ export function suppressExpectedErrors() { @@ -158,7 +174,31 @@ export function suppressExpectedErrors() {
message.includes('Medienressource') ||
(message.includes('fehlgeschlagen') && message.includes('URI')) ||
message.includes('Laden der Medienressource') ||
message.includes('Failed to load media resource')) {
message.includes('Failed to load media resource') ||
message.includes('OpaqueResponseBlocking') ||
message.includes('A resource is blocked by OpaqueResponseBlocking') ||
(message.includes('image/svg+xml') &&
(message.includes('nicht unterstützt') ||
message.includes('Keine Decoder') ||
message.includes('Medien können nicht')))) {
return
}
// German Firefox CORS (same-origin policy)
if (message.includes('Quellübergreifende') ||
message.includes('Gleiche-Quelle-Regel') ||
(message.includes('Cross-Origin') && message.includes('blockiert'))) {
return
}
if (
message.includes('kann keine Verbindung') &&
(message.includes('WebSocket') || message.includes('ws://') || message.includes('wss://'))
) {
return
}
if (message.includes('NS_BINDING_ABORTED')) {
return
}
@ -187,11 +227,14 @@ export function suppressExpectedErrors() { @@ -187,11 +227,14 @@ export function suppressExpectedErrors() {
return
}
// Suppress CORS policy warnings
// Suppress CORS policy warnings (EN + DE)
if (message.includes('CORS policy') ||
message.includes('Access-Control-Allow-Origin') ||
message.includes('has been blocked by CORS policy') ||
message.includes('blocked by CORS policy') ||
message.includes('Quellübergreifende') ||
message.includes('Gleiche-Quelle-Regel') ||
(message.includes('Cross-Origin') && message.includes('blockiert')) ||
(message.includes('Access to fetch') && message.includes('blocked')) ||
(message.includes('from origin') && message.includes('blocked'))) {
return
@ -222,7 +265,8 @@ export function suppressExpectedErrors() { @@ -222,7 +265,8 @@ export function suppressExpectedErrors() {
if (message.includes('NOTICE from') ||
message.includes('Too many subscriptions') ||
message.includes('Subscription rejected') ||
message.includes('too many concurrent REQs')) {
message.includes('too many concurrent REQs') ||
message.includes('too many kinds')) {
return
}
@ -255,7 +299,13 @@ export function suppressExpectedErrors() { @@ -255,7 +299,13 @@ export function suppressExpectedErrors() {
if (message.includes('NOTICE from') ||
message.includes('Too many subscriptions') ||
message.includes('Subscription rejected') ||
message.includes('too many concurrent REQs')) {
message.includes('too many concurrent REQs') ||
message.includes('too many kinds')) {
return
}
// Nostr browser extensions (signing / debug)
if (message.includes('[nos2x') || message.includes('nos2x-fox:')) {
return
}

2
src/lib/index-relay-http.ts

@ -90,7 +90,7 @@ function maybeLogDevIndexRelayUnreachableHint(): void { @@ -90,7 +90,7 @@ function maybeLogDevIndexRelayUnreachableHint(): void {
const now = Date.now()
if (now - lastDevIndexRelayTransportHintAt < DEV_INDEX_RELAY_TRANSPORT_HINT_MS) return
lastDevIndexRelayTransportHintAt = now
logger.info(
logger.debug(
'HTTP index relay is unreachable in dev. Start the relay, or set VITE_DEV_INDEX_RELAY_TARGET if it is not on the default URL.'
)
}

10
src/providers/NostrProvider/index.tsx

@ -140,7 +140,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) { @@ -140,7 +140,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
const init = async () => {
logger.info('[NostrProvider] Restoring session (login / first account)…')
logger.debug('[NostrProvider] Restoring session (login / first account)…')
if (hasNostrLoginHash()) {
return await loginByNostrLoginHash()
}
@ -153,7 +153,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) { @@ -153,7 +153,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) {
}
init()
.then(() => {
logger.info('[NostrProvider] Session restore finished; feeds and UI can initialize')
logger.debug('[NostrProvider] Session restore finished; feeds and UI can initialize')
setIsInitialized(true)
})
.catch((e) => {
@ -221,7 +221,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) { @@ -221,7 +221,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) {
hydrationGenForThisRun = accountHydrationGenerationRef.current += 1
setIsAccountSessionHydrating(true)
logger.info('[NostrProvider] Account session hydrate: loading cache and relays…', {
logger.debug('[NostrProvider] Account session hydrate: loading cache and relays…', {
pubkeySlice: account.pubkey.slice(0, 12),
hydrationGen: hydrationGenForThisRun
})
@ -639,11 +639,11 @@ export function NostrProvider({ children }: { children: React.ReactNode }) { @@ -639,11 +639,11 @@ export function NostrProvider({ children }: { children: React.ReactNode }) {
storage.setAccountNetworkHydrateAt(account.pubkey, Date.now())
void client.runSessionPrewarm({ pubkey: account.pubkey, signal: controller.signal })
logger.info('[NostrProvider] Account session hydrate: core relay/profile merge finished; client prewarm started (parallel)', {
logger.debug('[NostrProvider] Account session hydrate: core relay/profile merge finished; client prewarm started (parallel)', {
pubkeySlice: account.pubkey.slice(0, 12)
})
} else {
logger.info('[NostrProvider] Skipped network hydrate (within min interval); IndexedDB cache only', {
logger.debug('[NostrProvider] Skipped network hydrate (within min interval); IndexedDB cache only', {
pubkeySlice: account.pubkey.slice(0, 12),
lastNetworkHydrateAt,
ageMs: Date.now() - (lastNetworkHydrateAt ?? 0)

2
src/services/client.service.ts

@ -1700,7 +1700,7 @@ class ClientService extends EventTarget { @@ -1700,7 +1700,7 @@ class ClientService extends EventTarget {
) {
const timelineBatchId = `tl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 9)}`
const timelineT0 = performance.now()
logger.info('[RelayOp] timeline_wave_begin', {
logger.debug('[RelayOp] timeline_wave_begin', {
timelineBatchId,
shardCount: subRequests.length,
relayCountsPerShard: subRequests.map((r) => r.urls.length),

8
src/services/relay-operation-log.service.ts

@ -135,7 +135,7 @@ function groupTerminalsByOutcome(rows: RelayOpTerminalRow[]): Record<string, { c @@ -135,7 +135,7 @@ function groupTerminalsByOutcome(rows: RelayOpTerminalRow[]): Record<string, { c
* Tracks one logical subscribe/query wave: one `batch_begin` and one `batch_end` with per-relay outcomes.
*/
export type RelaySubscribeOpBatchOptions = {
/** `debug` hides high-volume query REQs unless jumble-debug / VITE_DEBUG is on. */
/** `info` logs every REQ wave at INFO; default `debug` keeps subscribe noise behind jumble-debug / VITE_DEBUG. */
logLevel?: 'info' | 'debug'
/** Invoked once when this REQ wave finishes (same `rows` as `batch_end` / `terminals`). */
onBatchEnd?: (rows: RelayOpTerminalRow[]) => void
@ -190,7 +190,7 @@ export class RelaySubscribeOpBatch { @@ -190,7 +190,7 @@ export class RelaySubscribeOpBatch {
this.t0 = typeof performance !== 'undefined' ? performance.now() : Date.now()
this.source = source
this.grouped = grouped
this.logLevel = options?.logLevel ?? 'info'
this.logLevel = options?.logLevel ?? 'debug'
this.onBatchEnd = options?.onBatchEnd
}
@ -329,7 +329,7 @@ export class RelayPublishOpBatch { @@ -329,7 +329,7 @@ export class RelayPublishOpBatch {
}
logBegin(): void {
logger.info('[RelayOp] publish_batch_begin', {
logger.debug('[RelayOp] publish_batch_begin', {
batchId: this.batchId,
source: this.source,
eventId: this.eventId,
@ -370,7 +370,7 @@ export class RelayPublishOpBatch { @@ -370,7 +370,7 @@ export class RelayPublishOpBatch {
]
.filter(Boolean)
.join('\n')
logger.info('[RelayOp] publish_batch_end', {
logger.debug('[RelayOp] publish_batch_end', {
batchId: this.batchId,
source: this.source,
eventId: this.eventId,

Loading…
Cancel
Save