When adding or modifying logging, follow these rules:

1) Attribute logs to the right component/instance

2) Pick the right level and avoid noise

3) Never silently fall back

4) Use the logging API’s formatting instead of fmt.Sprintf

5) Don’t bloat request/context just to move logs

Example patterns:

// 1+3) Instance-safe warning on fallback
if err != nil {
    logger.Warn("oauth: url parse failed, falling back to direct client: %v", err)
}

// 2) Correct level + log once (stream-aware)
if isStream && !isFinalChunk {
    // skip warning
} else {
    logger.Debug("cache: skipping write (namespace=%s, id=%s): no embedding available", ns, id)
}

// 4) Prefer format args
logger.Warn("logstore: skipping index maintenance: could not acquire index lock: %v", err)

// 5) Avoid reading logs back from fasthttp context; use dedicated slot/completer
// e.g., middleware publishes into a known slot, handler drains it after stream completes.

Applying this consistently reduces production log spam, preserves accurate attribution, improves diagnostics when fallbacks occur, and keeps logging implementation clean and maintainable.