funcaspect branch for func integration
[plcapi.git] / aspects / __init__.py
1 from pyaspects.weaver import weave_class_method
2
3 from PLC.Method import Method
4 from aspects.omfaspects import OMFAspect
5 from aspects.ratelimitaspects import RateLimitAspect
6 #disabled for now - caglar
7 #from aspects.funcaspects import FuncAspect
8
9 def apply_omf_aspect():
10     # track all PLC methods to add OMF hooks
11     weave_class_method(OMFAspect(), Method, "__call__")
12     weave_class_method(RateLimitAspect(), Method, "__call__")
13 #disabled for now - caglar
14 #    weave_class_method(FuncAspect(), Method, "__call__")
15
16 def apply_debugger_aspect():
17     # just log all method calls w/ their parameters
18     from pyaspects.debuggeraspect import DebuggerAspect
19     weave_class_method(DebuggerAspect(out=open("/tmp/all_method_calls.log", "a")), Method, "__call__")
20