mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Improve logging
This commit is contained in:
parent
5d36cd2f7e
commit
dba9e7d3ab
9
twoot.py
9
twoot.py
|
@ -1162,7 +1162,7 @@ def main(argv):
|
|||
logging.info('%d toots not posted due to configured cap', len(tweets) - TOML['options']['toot_cap'])
|
||||
break
|
||||
|
||||
logging.debug('Uploading Tweet %s', tweet["tweet_id"])
|
||||
logging.debug('Uploading Tweet %s', tweet['tweet_id'])
|
||||
|
||||
media_ids = []
|
||||
|
||||
|
@ -1222,7 +1222,8 @@ def main(argv):
|
|||
_, _, _, exception_message = e.args
|
||||
if 'Text character limit' in exception_message:
|
||||
# ERROR (('Mastodon API returned error', 422, 'Unprocessable Entity', 'Validation failed: Text character limit of 500 exceeded'))
|
||||
logging.error('Toot text too long: %s characters. Skipping.', str(len(tweet['tweet_text'])))
|
||||
logging.error('Toot text too long: %s characters', str(len(tweet['tweet_text'])))
|
||||
logging.error('posting ' + tweet['tweet_id'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
continue
|
||||
elif 'Try again in a moment' in exception_message:
|
||||
# ERROR ('Mastodon API returned error', 422, 'Unprocessable Entity', 'Cannot attach files that have not finished processing. Try again in a moment!')
|
||||
|
@ -1233,13 +1234,13 @@ def main(argv):
|
|||
try:
|
||||
toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids)
|
||||
except MastodonError as me:
|
||||
logging.error('posting ' + tweet['tweet_text'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
logging.error('posting ' + tweet['tweet_id'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
logging.error(me)
|
||||
else:
|
||||
logging.warning("Retry successful")
|
||||
|
||||
except MastodonError as me:
|
||||
logging.error('posting ' + tweet['tweet_text'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
logging.error('posting ' + tweet['tweet_id'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
logging.error(me)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user