-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Currently all "logs" are just print statements to stdout. Use a proper logger so that crashes and exceptions get sent to one spot while tracking of responses goes to a different log.
Describe the solution you'd like
A separation of crashes like:
File "bot.py", line 259, in <module>
for comment in r.subreddit(SUBREDDIT_NAME).stream.comments():
File "/home/pi/.local/lib/python3.7/site-packages/praw/models/util.py", line 186, in stream_generator
for item in reversed(list(function(limit=limit, **function_kwargs))):
File "/home/pi/.local/lib/python3.7/site-packages/praw/models/listing/generator.py", line 61, in __next__
self._next_batch()
File "/home/pi/.local/lib/python3.7/site-packages/praw/models/listing/generator.py", line 71, in _next_batch
self._listing = self._reddit.get(self.url, params=self.params)
File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 490, in get
return self._objectify_request(method="GET", params=params, path=path)
File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 574, in _objectify_request
data=data, files=files, method=method, params=params, path=path
File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 732, in request
timeout=self.config.timeout,
File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 336, in request
url=url,
File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 262, in _request_with_retries
url,
File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 170, in _do_retry
retry_strategy_state=retry_strategy_state.consume_available_retry(), # noqa: E501
File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 262, in _request_with_retries
url,
File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 170, in _do_retry
retry_strategy_state=retry_strategy_state.consume_available_retry(), # noqa: E501
File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 265, in _request_with_retries
raise self.STATUS_EXCEPTIONS[response.status_code](response)
prawcore.exceptions.ServerError: received 503 HTTP response
From normal log messages like:
Setting up DB...
Done!
Looking for comments...
Comment hash: fscc3yb
Request url: https://api.imgur.com/3/album/MqT99lp/images
Image link: https://i.imgur.com/OoXu0jY.jpg
Hash: fscc3yb
Has responded: True
Response type: op
Comment Body:
b'!MFAImageBot op 33\n\nLets see if this works...'
Tokens: [b'!MFAImageBot', b'op', b'33', b'Lets', b'see', b'if', b'this', b'works...']
Response comment body:
b'[#33](https://i.imgur.com/OoXu0jY.jpg) \nImage number 33 from album https://imgur.com/a/MqT99lp'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All that's probably needed is just to change the print statements into logger stuff but I want to make sure I understand where the output and stuff is going.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request