I found same similar question, but my question is diffent
def trace ():
?
class A():
@staticmethod
def Aha():
trace ()
...
I want the trace output
A.Aha() was called
I have known how to get function name through inspection, and get class name of instance.method
, such this:
self_argument = frame.f_code.co_varnames[0] # This *should* be 'self'.
instance = frame.f_locals[self_argument]
class_name = instance.__class__.__name__
but class static method have not self argument, what should I do ?