From 8f0ece35708a16ab224e1cd89f914f1781b6e299 Mon Sep 17 00:00:00 2001 From: AllfatherHatt Date: Mon, 16 Mar 2026 12:14:01 +0100 Subject: [PATCH] Adding updated debug stuff --- reginaldCog/debug_stuff.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/reginaldCog/debug_stuff.py b/reginaldCog/debug_stuff.py index 92ccdf0..fe17cc1 100644 --- a/reginaldCog/debug_stuff.py +++ b/reginaldCog/debug_stuff.py @@ -1,15 +1,24 @@ +import functools +import inspect + + def debug(func): + if inspect.iscoroutinefunction(func): + + @functools.wraps(func) + async def wrap(*args, **kwargs): + print(f"DEBUG: Calling {func.__name__} with args: {args}, kwargs: {kwargs}") + result = await func(*args, **kwargs) + print(f"DEBUG: {func.__name__} returned: {result}") + return result + + return wrap + + @functools.wraps(func) def wrap(*args, **kwargs): - # Log the function name and arguments print(f"DEBUG: Calling {func.__name__} with args: {args}, kwargs: {kwargs}") - - # Call the original function result = func(*args, **kwargs) - - # Log the return value print(f"DEBUG: {func.__name__} returned: {result}") - - # Return the result return result return wrap