BUG: check that self.logger exists

`self.logger` is initialized as `None` and there is no guarantee that
users have set it, so check that it exists before trying to pass
messages to it.
This commit is contained in:
Jeremiah Lowin
2014-03-23 15:44:40 -04:00
committed by Eddie Hebert
parent 51c8a310be
commit d00edbcf04
+2 -1
View File
@@ -471,7 +471,8 @@ class TradingAlgorithm(object):
zero_message = "Price of 0 for {psid}; can't infer value".format(
psid=sid
)
self.logger.debug(zero_message)
if self.logger:
self.logger.debug(zero_message)
# Don't place any order
return
else: