mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 01:42:30 -05:00
Audio cleanup (#5618)
* add different logging level callbacks for task exception logging * Add callback to tasks which didn't have them * The boring stuff - (apply .trace() and .verbose() to audio, stop using debug_exc_log, delete audio_logging.py) * Unsured import cleanup * use new lavalink method * return so it doesn't log this twice. * improve logging on main event handler
This commit is contained in:
@@ -16,7 +16,6 @@ from redbot.core.i18n import Translator
|
||||
from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils.dbtools import APSWConnectionWrapper
|
||||
|
||||
from ..audio_logging import debug_exc_log
|
||||
from ..sql_statements import (
|
||||
LAVALINK_CREATE_INDEX,
|
||||
LAVALINK_CREATE_TABLE,
|
||||
@@ -124,7 +123,7 @@ class BaseWrapper:
|
||||
current_version = row_result.fetchone()
|
||||
break
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Failed to completed fetch from database")
|
||||
log.verbose("Failed to completed fetch from database", exc_info=exc)
|
||||
if isinstance(current_version, tuple):
|
||||
current_version = current_version[0]
|
||||
if current_version == _SCHEMA_VERSION:
|
||||
@@ -141,7 +140,7 @@ class BaseWrapper:
|
||||
with self.database.transaction() as transaction:
|
||||
transaction.executemany(self.statement.upsert, values)
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Error during table insert")
|
||||
log.trace("Error during table insert", exc_info=exc)
|
||||
|
||||
async def update(self, values: MutableMapping) -> None:
|
||||
"""Update an entry of the local cache"""
|
||||
@@ -152,7 +151,7 @@ class BaseWrapper:
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
|
||||
executor.submit(self.database.cursor().execute, self.statement.update, values)
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Error during table update")
|
||||
log.verbose("Error during table update", exc_info=exc)
|
||||
|
||||
async def _fetch_one(
|
||||
self, values: MutableMapping
|
||||
@@ -173,7 +172,7 @@ class BaseWrapper:
|
||||
row_result = future.result()
|
||||
row = row_result.fetchone()
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Failed to completed fetch from database")
|
||||
log.verbose("Failed to completed fetch from database", exc_info=exc)
|
||||
if not row:
|
||||
return None
|
||||
if self.fetch_result is None:
|
||||
@@ -195,7 +194,7 @@ class BaseWrapper:
|
||||
try:
|
||||
row_result = future.result()
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Failed to completed fetch from database")
|
||||
log.verbose("Failed to completed fetch from database", exc_info=exc)
|
||||
async for row in AsyncIter(row_result):
|
||||
output.append(self.fetch_result(*row))
|
||||
return output
|
||||
@@ -223,7 +222,7 @@ class BaseWrapper:
|
||||
else:
|
||||
row = None
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Failed to completed random fetch from database")
|
||||
log.verbose("Failed to completed random fetch from database", exc_info=exc)
|
||||
if not row:
|
||||
return None
|
||||
if self.fetch_result is None:
|
||||
@@ -353,7 +352,7 @@ class LavalinkTableWrapper(BaseWrapper):
|
||||
try:
|
||||
row_result = future.result()
|
||||
except Exception as exc:
|
||||
debug_exc_log(log, exc, "Failed to completed fetch from database")
|
||||
log.verbose("Failed to completed fetch from database", exc_info=exc)
|
||||
async for row in AsyncIter(row_result):
|
||||
output.append(self.fetch_for_global(*row))
|
||||
return output
|
||||
|
||||
Reference in New Issue
Block a user