Make logs a little bit more informative. (#100)

This commit is contained in:
Giacomo Leidi 2021-11-20 15:53:38 +01:00 committed by GitHub
parent 2476686c33
commit ed8f752fe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 10 deletions

View File

@ -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")

View File

@ -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,

View File

@ -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()