Make logs a little bit more informative. (#100)
This commit is contained in:
parent
2476686c33
commit
ed8f752fe6
|
@ -44,7 +44,7 @@ async def start():
|
||||||
)
|
)
|
||||||
|
|
||||||
if event:
|
if event:
|
||||||
logger.debug(f"Event to publish found: {event.name}")
|
logger.info(f"Event to publish found: {event.name}")
|
||||||
|
|
||||||
models = await create_event_publication_models(event)
|
models = await create_event_publication_models(event)
|
||||||
publications = list(EventPublication.from_orm(m, event) for m in models)
|
publications = list(EventPublication.from_orm(m, event) for m in models)
|
||||||
|
@ -55,4 +55,4 @@ async def start():
|
||||||
if not report.succesful:
|
if not report.succesful:
|
||||||
PublicationFailureNotifiersCoordinator(report,).notify_failure()
|
PublicationFailureNotifiersCoordinator(report,).notify_failure()
|
||||||
else:
|
else:
|
||||||
logger.debug("No event to publish found")
|
logger.info("No event to publish found")
|
||||||
|
|
|
@ -82,6 +82,7 @@ class PublisherCoordinator:
|
||||||
for publication in self.publications:
|
for publication in self.publications:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
logger.info(f"Publishing to {publication.publisher.name}")
|
||||||
message = publication.formatter.get_message_from_event(
|
message = publication.formatter.get_message_from_event(
|
||||||
publication.event
|
publication.event
|
||||||
)
|
)
|
||||||
|
@ -94,6 +95,7 @@ class PublisherCoordinator:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except PublisherError as e:
|
except PublisherError as e:
|
||||||
|
logger.error(str(e))
|
||||||
reports.append(
|
reports.append(
|
||||||
EventPublicationReport(
|
EventPublicationReport(
|
||||||
status=PublicationStatus.FAILED,
|
status=PublicationStatus.FAILED,
|
||||||
|
|
|
@ -41,13 +41,5 @@ class MoReDB:
|
||||||
await update_publishers(publisher_names)
|
await update_publishers(publisher_names)
|
||||||
|
|
||||||
|
|
||||||
@atexit.register
|
|
||||||
def gracefully_tear_down():
|
|
||||||
logger.info("Shutting down DB")
|
|
||||||
loop = asyncio.new_event_loop()
|
|
||||||
asyncio.set_event_loop(loop)
|
|
||||||
asyncio.run(tear_down())
|
|
||||||
|
|
||||||
|
|
||||||
async def tear_down():
|
async def tear_down():
|
||||||
return await Tortoise.close_connections()
|
return await Tortoise.close_connections()
|
||||||
|
|
Loading…
Reference in New Issue