From 37fb799a1e2f46d56d3b60906b20b8e201151881 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 16 Nov 2022 13:05:23 +1100 Subject: [PATCH] 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 --- statusbot/bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/statusbot/bot.py b/statusbot/bot.py index 7f259d0..56731b5 100755 --- a/statusbot/bot.py +++ b/statusbot/bot.py @@ -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