mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 09:52:30 -05:00
Bump RLL and improve logging (#5044)
* version bump * - bump RLL - logging changes - player.channel.guild->player.guild - small cleanup around logging changes * missed one * here this one too * Apply suggestions from code review Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * add one missing player log * missed one * Format with Black Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -78,14 +78,16 @@ class GlobalCacheWrapper:
|
||||
search_response = await r.json(loads=json.loads)
|
||||
if IS_DEBUG and "x-process-time" in r.headers:
|
||||
log.debug(
|
||||
f"GET || Ping {r.headers.get('x-process-time')} || "
|
||||
f"Status code {r.status} || {query}"
|
||||
"GET || Ping %s || Status code %d || %s",
|
||||
r.headers.get("x-process-time"),
|
||||
r.status,
|
||||
query,
|
||||
)
|
||||
if "tracks" not in search_response:
|
||||
return {}
|
||||
return search_response
|
||||
except Exception as err:
|
||||
debug_exc_log(log, err, f"Failed to Get query: {api_url}/{query}")
|
||||
debug_exc_log(log, err, "Failed to Get query: %s/%s", api_url, query)
|
||||
return {}
|
||||
|
||||
async def get_spotify(self, title: str, author: Optional[str]) -> dict:
|
||||
@@ -108,14 +110,17 @@ class GlobalCacheWrapper:
|
||||
search_response = await r.json(loads=json.loads)
|
||||
if IS_DEBUG and "x-process-time" in r.headers:
|
||||
log.debug(
|
||||
f"GET/spotify || Ping {r.headers.get('x-process-time')} || "
|
||||
f"Status code {r.status} || {title} - {author}"
|
||||
"GET/spotify || Ping %s || Status code %d || %s - %s",
|
||||
r.headers.get("x-process-time"),
|
||||
r.status,
|
||||
title,
|
||||
author,
|
||||
)
|
||||
if "tracks" not in search_response:
|
||||
return {}
|
||||
return search_response
|
||||
except Exception as err:
|
||||
debug_exc_log(log, err, f"Failed to Get query: {api_url}")
|
||||
debug_exc_log(log, err, "Failed to Get query: %s", api_url)
|
||||
return {}
|
||||
|
||||
async def post_call(self, llresponse: LoadResult, query: Optional[Query]) -> None:
|
||||
@@ -142,11 +147,13 @@ class GlobalCacheWrapper:
|
||||
await r.read()
|
||||
if IS_DEBUG and "x-process-time" in r.headers:
|
||||
log.debug(
|
||||
f"POST || Ping {r.headers.get('x-process-time')} ||"
|
||||
f" Status code {r.status} || {query}"
|
||||
"GET || Ping %s || Status code %d || %s",
|
||||
r.headers.get("x-process-time"),
|
||||
r.status,
|
||||
query,
|
||||
)
|
||||
except Exception as err:
|
||||
debug_exc_log(log, err, f"Failed to post query: {query}")
|
||||
debug_exc_log(log, err, "Failed to post query: %s", query)
|
||||
await asyncio.sleep(0)
|
||||
|
||||
async def update_global(self, llresponse: LoadResult, query: Optional[Query] = None):
|
||||
|
||||
Reference in New Issue
Block a user