use logger.traceback to log exceptions
This commit is contained in:
parent
bff7bcf1fd
commit
691368fe2d
1 changed files with 5 additions and 6 deletions
|
@ -14,7 +14,6 @@ import logging
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
@ -58,7 +57,7 @@ class SessionCache(object):
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
except: # pragma: nocover
|
except: # pragma: nocover
|
||||||
log.error(traceback.format_exc())
|
log.traceback()
|
||||||
|
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
|
@ -73,7 +72,7 @@ class SessionCache(object):
|
||||||
try:
|
try:
|
||||||
conn, c = self.connect()
|
conn, c = self.connect()
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.traceback()
|
||||||
return requests.session()
|
return requests.session()
|
||||||
|
|
||||||
session = None
|
session = None
|
||||||
|
@ -84,12 +83,12 @@ class SessionCache(object):
|
||||||
if row is not None:
|
if row is not None:
|
||||||
session = pickle.loads(row[0])
|
session = pickle.loads(row[0])
|
||||||
except: # pragma: nocover
|
except: # pragma: nocover
|
||||||
log.error(traceback.format_exc())
|
log.traceback()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn.close()
|
conn.close()
|
||||||
except: # pragma: nocover
|
except: # pragma: nocover
|
||||||
log.error(traceback.format_exc())
|
log.traceback()
|
||||||
|
|
||||||
return session if session is not None else requests.session()
|
return session if session is not None else requests.session()
|
||||||
|
|
||||||
|
@ -106,4 +105,4 @@ class SessionCache(object):
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.traceback()
|
||||||
|
|
Loading…
Reference in a new issue