only log errors if logging is enabled
authorTony Mack <tmack@cs.princeton.edu>
Fri, 30 May 2008 18:16:47 +0000 (18:16 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Fri, 30 May 2008 18:16:47 +0000 (18:16 +0000)
PLC/Method.py

index 74dc862..71977e6 100644 (file)
@@ -91,7 +91,7 @@ class Method:
        
            result = self.call(*args, **kwds)
            runtime = time.time() - start
-
+       
             if self.api.config.PLC_API_DEBUG or hasattr(self, 'message'):
                self.log(None, runtime, *args)
                
@@ -108,8 +108,11 @@ class Method:
             # Prepend caller and method name to expected faults
             fault.faultString = caller + ": " +  self.name + ": " + fault.faultString
            runtime = time.time() - start
-           self.log(fault, runtime, *args)
-            raise fault
+           
+           if self.api.config.PLC_API_DEBUG:
+               self.log(fault, runtime, *args)
+            
+           raise fault
 
     def log(self, fault, runtime, *args):
         """