minor refactor

This commit is contained in:
AF 2022-12-24 16:37:21 +00:00
parent d6d3b873de
commit 85aa795e35
2 changed files with 3 additions and 4 deletions

View File

@ -13,7 +13,6 @@ class Context:
self.message: discord.Message = message
self.client: discord.Client = client
self.channel: discord.abc.Messageable = message.channel
self.dm_or_text: Union[discord.DMChannel, discord.TextChannel] = message.channel # type: ignore
self.author: usertype = message.author
self.content: str = message.content
self.member: Optional[discord.Member] = message.author if isinstance(message.author, discord.Member) else None

View File

@ -1,4 +1,5 @@
import asyncio
import inspect
import os
import time
@ -10,7 +11,7 @@ class ALog(Instrumentation):
def time(self):
return time.time() - self.start
async def instrument(self, method, *args, **kwargs):
key = os.urandom(4).hex()
print(f'[{self.time(): 11.3f}] +{key} +A"{self.methodname}"')
@ -27,7 +28,7 @@ class ALog(Instrumentation):
class SLog(Instrumentation):
def time(self):
return time.time() - ALog.start
def instrument(self, method, *args, **kwargs):
key = os.urandom(4).hex()
print(f'[{self.time(): 11.3f}] +{key} +S"{self.methodname}"')
@ -43,7 +44,6 @@ class SLog(Instrumentation):
class FrameTrace(Instrumentation):
async def instrument(self, method, *args, **kwargs):
import inspect
frame = inspect.currentframe()
while frame is not None:
print(frame.f_code.co_filename, frame.f_lineno)