X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fmethod.py;h=ec9440e5bfb481473045a71b37c98d081c8b49fe;hb=bd60a17bf40068295505502d719aa409b851f9c3;hp=1df1245789f7e27fa5c83dba91c02c035f715762;hpb=3d7237fa0b5f2b4a60cb97c7fb3b6aecfd94558a;p=sfa.git diff --git a/sfa/util/method.py b/sfa/util/method.py index 1df12457..ec9440e5 100644 --- a/sfa/util/method.py +++ b/sfa/util/method.py @@ -14,10 +14,10 @@ import textwrap import xmlrpclib +from sfa.util.sfalogging import sfa_logger from sfa.util.faults import * from sfa.util.parameter import Parameter, Mixed, python_type, xmlrpc_type from sfa.trust.auth import Auth -from sfa.util.debug import profile, log # we inherit object because we use new-style classes for legacy methods class Method (object): @@ -74,7 +74,7 @@ class Method (object): start = time.time() methodname = self.name if not self.api.interface or self.api.interface not in self.interfaces: - raise SfaInvalidAPIMethod, methodname, self.api.interface + raise SfaInvalidAPIMethod(methodname, self.api.interface) # legacy code cannot be type-checked, due to the way Method.args() works if not hasattr(self,"skip_typecheck"): @@ -91,9 +91,8 @@ class Method (object): runtime = time.time() - start if self.api.config.SFA_API_DEBUG or hasattr(self, 'message'): - # XX print to some log file - # print >> log, "some output" - pass + msg=getattr(self,'message',"method %s completed in %02f s"%(methodname,runtime)) + sfa_logger.info(msg) return result @@ -104,9 +103,7 @@ class Method (object): # Prepend caller and method name to expected faults fault.faultString = caller + ": " + self.name + ": " + fault.faultString runtime = time.time() - start - - if self.api.config.SFA_API_DEBUG: - traceback.print_exc() + sfa_logger.log_exc("Method %s raised an exception"%self.name) raise fault