SND@LHC Software
|
Public Member Functions | |
__init__ (self, wrapped_instance, sink=sys.stdout) | |
method_logger (self, met) | |
__getattr__ (self, attr) | |
Protected Attributes | |
_class | |
_sink | |
_prefix | |
This class wraps a instance of an arbitrary class, intercepts all its method calls and logs them to a file (default: `sys.stdout`). >>> import method_logger as ml >>> from StringIO import StringIO >>> class TestClass(object): ... def __init__(self): ... pass ... def func(*args, **kwargs): ... pass ... >>> cl = TestClass() >>> sink = StringIO() >>> lg = ml.MethodLogger(cl, sink=sink) >>> lg.func(3, y=8, foo='bar') >>> sink.getvalue() "TestClass.func(3, y=8, foo='bar')\\n" >>> sink.close()
Definition at line 8 of file method_logger.py.
method_logger.MethodLogger.__init__ | ( | self, | |
wrapped_instance, | |||
sink = sys.stdout |
|||
) |
Definition at line 29 of file method_logger.py.
method_logger.MethodLogger.__getattr__ | ( | self, | |
attr | |||
) |
Definition at line 45 of file method_logger.py.
method_logger.MethodLogger.method_logger | ( | self, | |
met | |||
) |
Definition at line 34 of file method_logger.py.
|
protected |
Definition at line 30 of file method_logger.py.
|
protected |
Definition at line 32 of file method_logger.py.
|
protected |
Definition at line 31 of file method_logger.py.