Browse Source

Better log formatting

master
Neil Booth 8 years ago
parent
commit
59b2b2cb04
  1. 12
      server/daemon.py

12
server/daemon.py

@ -58,7 +58,7 @@ class Daemon(util.LoggedClass):
if msg != self.prior_msg or self.skip_count == 0: if msg != self.prior_msg or self.skip_count == 0:
self.skip_count = 10 self.skip_count = 10
self.prior_msg = msg self.prior_msg = msg
self.logger.error('{}. Retrying between sleeps...' self.logger.error('{} Retrying between sleeps...'
.format(msg)) .format(msg))
self.skip_count -= 1 self.skip_count -= 1
@ -73,19 +73,19 @@ class Daemon(util.LoggedClass):
self.logger.info('connection restored') self.logger.info('connection restored')
return result return result
except asyncio.TimeoutError: except asyncio.TimeoutError:
log_error('timeout error', skip_once=True) log_error('timeout error.', skip_once=True)
except aiohttp.ClientHttpProcessingError: except aiohttp.ClientHttpProcessingError:
log_error('HTTP error', skip_once=True) log_error('HTTP error.', skip_once=True)
except aiohttp.ServerDisconnectedError: except aiohttp.ServerDisconnectedError:
log_error('disconnected', skip_once=True) log_error('disconnected.', skip_once=True)
except aiohttp.ClientConnectionError: except aiohttp.ClientConnectionError:
log_error('connection problem - is your daemon running?') log_error('connection problem - is your daemon running?')
except self.DaemonWarmingUpError: except self.DaemonWarmingUpError:
log_error('still starting up checking blocks...') log_error('still starting up checking blocks.')
except (asyncio.CancelledError, DaemonError): except (asyncio.CancelledError, DaemonError):
raise raise
except Exception as e: except Exception as e:
log_error('request gave unexpected error: {}'.format(e)) log_error('request gave unexpected error: {}.'.format(e))
await asyncio.sleep(secs) await asyncio.sleep(secs)
secs = min(16, secs * 2) secs = min(16, secs * 2)

Loading…
Cancel
Save