Skip to content

Commit 90730a4

Browse files
committed
feat(server): clarify Spotify search Redis cache debug logs
Include cache key, query variants, timing, and a compact top-result preview on hits so logs show what was served without dumping full payloads.
1 parent 3c92a8a commit 90730a4

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

‎server/src/lib/providers/spotify.js‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,26 @@ class Spotify {
264264
{ key: 'durationMs', value: Date.now() - cacheStart },
265265
]);
266266

267+
const items = searchTracks?.tracks?.items ?? [];
268+
const top = items[0];
267269
logger.debug({
268270
method: 'searchTracksWithCache',
269271
message: 'Cache hit for query, fetching from Redis instead of API call',
270272
metadata: {
271-
args: [...arguments],
272-
searchTracks,
273+
cacheKey,
274+
normalizedQuery,
275+
limit,
276+
query: String(query ?? ''),
277+
redisGetMs: Date.now() - cacheStart,
278+
cachedTrackCount: items.length,
279+
cachedTopResult:
280+
top != null
281+
? {
282+
id: top.id,
283+
name: top.name,
284+
artists: top.artists?.map((a) => a.name).join(', ') || undefined,
285+
}
286+
: null,
273287
},
274288
});
275289
} else {
@@ -282,8 +296,11 @@ class Spotify {
282296
method: 'searchTracksWithCache',
283297
message: 'Cache miss for query',
284298
metadata: {
285-
args: [...arguments],
286-
searchTracks,
299+
cacheKey,
300+
normalizedQuery,
301+
limit,
302+
query: String(query ?? ''),
303+
redisGetMs: Date.now() - cacheStart,
287304
},
288305
});
289306

0 commit comments

Comments
 (0)