forked from LBRYCommunity/lbry-sdk
catch RuntimeError in loggly handler to handle cases where there is not an event loop
This commit is contained in:
parent
563d76ff9f
commit
646ae7e2d1
1 changed files with 5 additions and 1 deletions
|
@ -68,7 +68,11 @@ class HTTPSLogglyHandler(logging.Handler):
|
|||
return await self._emit(record, retry=False)
|
||||
|
||||
def emit(self, record):
|
||||
asyncio.ensure_future(self._emit(record))
|
||||
try:
|
||||
asyncio.ensure_future(self._emit(record), loop=self._loop)
|
||||
except RuntimeError: # TODO: use a second loop
|
||||
print(f"\nfailed to send traceback to loggly, please file an issue with the following traceback:\n"
|
||||
f"{self.format(record)}")
|
||||
|
||||
def close(self):
|
||||
super().close()
|
||||
|
|
Loading…
Add table
Reference in a new issue