forked from tanner/qotnews
Improve logging
This commit is contained in:
parent
dcedd4caa1
commit
3f774a9e38
|
@ -33,10 +33,10 @@ def feed():
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except PRAWException as e:
|
except PRAWException as e:
|
||||||
logging.error('Problem hitting reddit API: {}'.format(str(e)))
|
logging.critical('Problem hitting reddit API: {}'.format(str(e)))
|
||||||
return []
|
return []
|
||||||
except PrawcoreException as e:
|
except PrawcoreException as e:
|
||||||
logging.error('Problem hitting reddit API: {}'.format(str(e)))
|
logging.critical('Problem hitting reddit API: {}'.format(str(e)))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def comment(i):
|
def comment(i):
|
||||||
|
@ -84,10 +84,10 @@ def story(ref):
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except PRAWException as e:
|
except PRAWException as e:
|
||||||
logging.error('Problem hitting reddit API: {}'.format(str(e)))
|
logging.critical('Problem hitting reddit API: {}'.format(str(e)))
|
||||||
return False
|
return False
|
||||||
except PrawcoreException as e:
|
except PrawcoreException as e:
|
||||||
logging.error('Problem hitting reddit API: {}'.format(str(e)))
|
logging.critical('Problem hitting reddit API: {}'.format(str(e)))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# scratchpad so I can quickly develop the parser
|
# scratchpad so I can quickly develop the parser
|
||||||
|
|
|
@ -34,7 +34,7 @@ def api(route):
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
logging.error('Problem hitting tildes website: {}'.format(str(e)))
|
logging.critical('Problem hitting tildes website: {}'.format(str(e)))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def feed():
|
def feed():
|
||||||
|
@ -113,7 +113,7 @@ def story(ref):
|
||||||
|
|
||||||
# scratchpad so I can quickly develop the parser
|
# scratchpad so I can quickly develop the parser
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#print(feed())
|
print(feed())
|
||||||
#normal = story('gxt')
|
#normal = story('gxt')
|
||||||
#print(normal)
|
#print(normal)
|
||||||
#no_comments = story('gxr')
|
#no_comments = story('gxr')
|
||||||
|
@ -122,8 +122,8 @@ if __name__ == '__main__':
|
||||||
#print(self_post)
|
#print(self_post)
|
||||||
#li_comment = story('gqx')
|
#li_comment = story('gqx')
|
||||||
#print(li_comment)
|
#print(li_comment)
|
||||||
broken = story('q4y')
|
#broken = story('q4y')
|
||||||
print(broken)
|
#print(broken)
|
||||||
|
|
||||||
# make sure there's no self-reference
|
# make sure there's no self-reference
|
||||||
#import copy
|
#import copy
|
||||||
|
|
|
@ -65,6 +65,8 @@ def submit():
|
||||||
url = request.form['url']
|
url = request.form['url']
|
||||||
nid = new_id()
|
nid = new_id()
|
||||||
|
|
||||||
|
logging.info('Manual submission: ' + url)
|
||||||
|
|
||||||
parse = urlparse(url)
|
parse = urlparse(url)
|
||||||
if 'news.ycombinator.com' in parse.hostname:
|
if 'news.ycombinator.com' in parse.hostname:
|
||||||
source = 'hackernews'
|
source = 'hackernews'
|
||||||
|
@ -200,7 +202,7 @@ def feed_thread():
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logging.info('Ending feed thread...')
|
logging.info('Ending feed thread...')
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logging.error('feed_thread error: {} {}'.format(e.__class__.__name__, e))
|
logging.critical('feed_thread error: {} {}'.format(e.__class__.__name__, e))
|
||||||
http_server.stop()
|
http_server.stop()
|
||||||
|
|
||||||
print('Starting Feed thread...')
|
print('Starting Feed thread...')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user