mirror of
https://github.com/basicswap/basicswap.git
synced 2024-11-17 00:07:56 +00:00
Log traceback to file in debug mode.
This commit is contained in:
parent
053c263751
commit
4a7eff0118
3 changed files with 18 additions and 18 deletions
|
@ -577,7 +577,7 @@ class BasicSwap(BaseApp):
|
||||||
time.sleep(4) # Extra time to settle
|
time.sleep(4) # Extra time to settle
|
||||||
return
|
return
|
||||||
self.log.error('stopDaemon %s', str(ex))
|
self.log.error('stopDaemon %s', str(ex))
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
raise ValueError('Could not stop {}'.format(str(coin)))
|
raise ValueError('Could not stop {}'.format(str(coin)))
|
||||||
|
|
||||||
def stopDaemons(self):
|
def stopDaemons(self):
|
||||||
|
@ -3383,7 +3383,7 @@ class BasicSwap(BaseApp):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error('process_XMR_SWAP_A_LOCK_tx_spend %s', str(ex))
|
self.log.error('process_XMR_SWAP_A_LOCK_tx_spend %s', str(ex))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
session.close()
|
session.close()
|
||||||
session.remove()
|
session.remove()
|
||||||
|
@ -3438,7 +3438,7 @@ class BasicSwap(BaseApp):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error('process_XMR_SWAP_A_LOCK_REFUND_tx_spend %s', str(ex))
|
self.log.error('process_XMR_SWAP_A_LOCK_REFUND_tx_spend %s', str(ex))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
session.close()
|
session.close()
|
||||||
session.remove()
|
session.remove()
|
||||||
|
@ -3570,7 +3570,7 @@ class BasicSwap(BaseApp):
|
||||||
self.log.warning('Unknown event type: %d', row.event_type)
|
self.log.warning('Unknown event type: %d', row.event_type)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
self.log.error('checkEvents failed: {}'.format(str(ex)))
|
self.log.error('checkEvents failed: {}'.format(str(ex)))
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
@ -4226,7 +4226,7 @@ class BasicSwap(BaseApp):
|
||||||
session.remove()
|
session.remove()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
self.setBidError(bid.bid_id, bid, str(ex), xmr_swap=xmr_swap)
|
self.setBidError(bid.bid_id, bid, str(ex), xmr_swap=xmr_swap)
|
||||||
|
|
||||||
def watchXmrSwap(self, bid, offer, xmr_swap):
|
def watchXmrSwap(self, bid, offer, xmr_swap):
|
||||||
|
@ -4300,7 +4300,7 @@ class BasicSwap(BaseApp):
|
||||||
self.saveBidInSession(bid_id, bid, session, xmr_swap)
|
self.saveBidInSession(bid_id, bid, session, xmr_swap)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
|
|
||||||
def sendXmrBidCoinALockTx(self, bid_id, session):
|
def sendXmrBidCoinALockTx(self, bid_id, session):
|
||||||
# Send coin A lock tx and MSG4F L -> F
|
# Send coin A lock tx and MSG4F L -> F
|
||||||
|
@ -4685,7 +4685,7 @@ class BasicSwap(BaseApp):
|
||||||
self.saveBid(bid_id, bid, xmr_swap=xmr_swap)
|
self.saveBid(bid_id, bid, xmr_swap=xmr_swap)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
self.setBidError(bid_id, bid, str(ex))
|
self.setBidError(bid_id, bid, str(ex))
|
||||||
|
|
||||||
def processXmrBidLockSpendTx(self, msg):
|
def processXmrBidLockSpendTx(self, msg):
|
||||||
|
@ -4725,7 +4725,7 @@ class BasicSwap(BaseApp):
|
||||||
self.saveBid(bid_id, bid, xmr_swap=xmr_swap)
|
self.saveBid(bid_id, bid, xmr_swap=xmr_swap)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
self.setBidError(bid_id, bid, str(ex))
|
self.setBidError(bid_id, bid, str(ex))
|
||||||
|
|
||||||
# Update copy of bid in swaps_in_progress
|
# Update copy of bid in swaps_in_progress
|
||||||
|
@ -4791,7 +4791,7 @@ class BasicSwap(BaseApp):
|
||||||
ensure(v, 'verifyTxOtVES failed for chain a lock tx leader esig')
|
ensure(v, 'verifyTxOtVES failed for chain a lock tx leader esig')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
self.setBidError(bid_id, bid, str(ex))
|
self.setBidError(bid_id, bid, str(ex))
|
||||||
self.swaps_in_progress[bid_id] = (bid, offer)
|
self.swaps_in_progress[bid_id] = (bid, offer)
|
||||||
return
|
return
|
||||||
|
@ -4834,7 +4834,7 @@ class BasicSwap(BaseApp):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error('processMsg %s', str(ex))
|
self.log.error('processMsg %s', str(ex))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
self.mxDB.release()
|
self.mxDB.release()
|
||||||
|
|
||||||
|
@ -4871,7 +4871,7 @@ class BasicSwap(BaseApp):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error('smsg zmq %s', str(ex))
|
self.log.error('smsg zmq %s', str(ex))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
|
|
||||||
self.mxDB.acquire()
|
self.mxDB.acquire()
|
||||||
try:
|
try:
|
||||||
|
@ -4885,7 +4885,7 @@ class BasicSwap(BaseApp):
|
||||||
to_remove.append((bid_id, v[0], v[1]))
|
to_remove.append((bid_id, v[0], v[1]))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error('checkBidState %s', traceback.format_exc())
|
||||||
if self.is_transient_error(ex):
|
if self.is_transient_error(ex):
|
||||||
self.log.warning('checkBidState %s %s', bid_id.hex(), str(ex))
|
self.log.warning('checkBidState %s %s', bid_id.hex(), str(ex))
|
||||||
self.logBidEvent(bid_id, EventLogTypes.SYSTEM_WARNING, 'No connection to daemon', session=None)
|
self.logBidEvent(bid_id, EventLogTypes.SYSTEM_WARNING, 'No connection to daemon', session=None)
|
||||||
|
@ -4920,7 +4920,7 @@ class BasicSwap(BaseApp):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error('update %s', str(ex))
|
self.log.error('update %s', str(ex))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
traceback.print_exc()
|
self.log.error(traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
self.mxDB.release()
|
self.mxDB.release()
|
||||||
|
|
||||||
|
|
|
@ -827,7 +827,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||||
swap_client.setBidDebugInd(bytes.fromhex(sent_bid_id), debugind)
|
swap_client.setBidDebugInd(bytes.fromhex(sent_bid_id), debugind)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.server.swap_client.debug is True:
|
if self.server.swap_client.debug is True:
|
||||||
traceback.print_exc()
|
self.server.swap_client.log.error(traceback.format_exc())
|
||||||
messages.append('Error: Send bid failed: ' + str(ex))
|
messages.append('Error: Send bid failed: ' + str(ex))
|
||||||
show_bid_form = True
|
show_bid_form = True
|
||||||
|
|
||||||
|
@ -1297,7 +1297,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||||
return func(self, url_split, post_string, is_json)
|
return func(self, url_split, post_string, is_json)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.server.swap_client.debug is True:
|
if self.server.swap_client.debug is True:
|
||||||
traceback.print_exc()
|
self.server.swap_client.log.error(traceback.format_exc())
|
||||||
return js_error(self, str(ex))
|
return js_error(self, str(ex))
|
||||||
|
|
||||||
if len(url_split) > 1 and url_split[1] == 'static':
|
if len(url_split) > 1 and url_split[1] == 'static':
|
||||||
|
@ -1318,7 +1318,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.putHeaders(status_code, 'text/html')
|
self.putHeaders(status_code, 'text/html')
|
||||||
if self.server.swap_client.debug is True:
|
if self.server.swap_client.debug is True:
|
||||||
traceback.print_exc()
|
self.server.swap_client.log.error(traceback.format_exc())
|
||||||
return self.page_error(str(ex))
|
return self.page_error(str(ex))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1361,7 +1361,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||||
return self.page_index(url_split)
|
return self.page_index(url_split)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if self.server.swap_client.debug is True:
|
if self.server.swap_client.debug is True:
|
||||||
traceback.print_exc()
|
self.server.swap_client.log.error(traceback.format_exc())
|
||||||
return self.page_error(str(ex))
|
return self.page_error(str(ex))
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
|
|
|
@ -204,7 +204,7 @@ def msg_thread(cls):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning('process message error %s', str(e))
|
logging.warning('process message error %s', str(e))
|
||||||
if cls._sc.debug:
|
if cls._sc.debug:
|
||||||
traceback.print_exc()
|
logging.error(traceback.format_exc())
|
||||||
|
|
||||||
if processed is False:
|
if processed is False:
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
|
|
Loading…
Reference in a new issue