merge ratelimiting support from memcache branch
[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
7 def apply_omf_aspect():
8     # track all PLC methods to add OMF hooks
9     weave_class_method(OMFAspect(), Method, "__call__")
10     weave_class_method(RateLimitAspect(), Method, "__call__")
11
12 def apply_debugger_aspect():
13     # just log all method calls w/ their parameters
14     from pyaspects.debuggeraspect import DebuggerAspect
15     weave_class_method(DebuggerAspect(out=open("/tmp/all_method_calls.log", "a")), Method, "__call__")
16
17