Don't recurse on log() message
Both of these classes have a function called log(), so making the logger "log" is not what we want ... it leads to a debug log sending out toots ... Rename the logger variable Change-Id: I00007daa4763bd05a8f600369d1c65726f3831a6
This commit is contained in:
parent
0263b3abda
commit
37fb799a1e
@ -244,7 +244,7 @@ class UpdateInterface(object):
|
||||
|
||||
|
||||
class Tweet(UpdateInterface):
|
||||
log = logging.getLogger("statusbot.tweet")
|
||||
logger = logging.getLogger("statusbot.tweet")
|
||||
|
||||
def __init__(self, config):
|
||||
self.consumer_key = config.get('twitter', 'consumer_key')
|
||||
@ -278,7 +278,7 @@ class Tweet(UpdateInterface):
|
||||
in_reply_to_status_id = prior_tweet.id,
|
||||
auto_populate_reply_metadata=True)
|
||||
except tweepy.TweepyException as e:
|
||||
self.log.exception("Failed to tweet")
|
||||
self.logger.exception("Failed to tweet")
|
||||
|
||||
def alert(self, msg=None):
|
||||
# warning sign
|
||||
@ -300,7 +300,7 @@ class Tweet(UpdateInterface):
|
||||
|
||||
|
||||
class Toot(UpdateInterface):
|
||||
log = logging.getLogger("statusbot.toot")
|
||||
logger = logging.getLogger("statusbot.toot")
|
||||
|
||||
def __init__(self, config):
|
||||
self.host = config.get('mastodon', 'host')
|
||||
@ -318,9 +318,9 @@ class Toot(UpdateInterface):
|
||||
# not sure what to check for...
|
||||
if r.status_code == 200:
|
||||
json_data = r.json()
|
||||
self.log('Tooted id: %s' % json_data['id'])
|
||||
self.logger.debug('Tooted id: %s' % json_data['id'])
|
||||
else:
|
||||
self.log('Toot failed: %s' % r.status_code)
|
||||
self.logger.error('Toot failed: %s' % r.status_code)
|
||||
|
||||
def alert(self, msg=None):
|
||||
# warning sign
|
||||
|
Loading…
Reference in New Issue
Block a user