only log errors if logging is enabled
[plcapi.git] / PLC / Method.py
index d7297a1..71977e6 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Method.py,v 1.28 2007/08/20 19:11:08 tmack Exp $
+# $Id$
 #
 
 import xmlrpclib
@@ -91,8 +91,8 @@ class Method:
        
            result = self.call(*args, **kwds)
            runtime = time.time() - start
-
-            if self.api.config.PLC_API_DEBUG: #or hasattr(self, 'message'):
+       
+            if self.api.config.PLC_API_DEBUG or hasattr(self, 'message'):
                self.log(None, runtime, *args)
                
            return result
@@ -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):
         """