izumi
izumi copied to clipboard
Bring back integration check logging after integration checks were moved to core
We want to have some informative logging surrounding integration checks - when they start and when they unexpectedly throw an exception:
// PlanInterpreterNonSequentialImpl.scala
val logger: IzLogger = ???
private[this] def checkOrFail[F[_]: TagK](key: DIKey, resource: Any)(implicit F: QuasiIO[F]): F[Option[IntegrationCheckFailure]] = {
F.suspendF {
logger.debug(s"Checking $resource")
resource
.asInstanceOf[IntegrationCheck[F]]
.resourcesAvailable()
.flatMap {
case ResourceCheck.Success() =>
F.pure(None)
case failure: ResourceCheck.Failure =>
F.pure(Some(IntegrationCheckFailure(key, new IntegrationCheckException(NonEmptyList(failure)))))
}
.guaranteeOnFailure {
exception =>
F.maybeSuspend {
logger.crit(s"""Integration check for $resource threw unexpected $exception.
|Integration checks shouldn't throw, but should return `ResourceCheck.Failure`,
|considering this exception a critical failure and Aborting!""".stripMargin)
}
}
}
}
But the problem is that we don't have accesss to logstage IzLogger in distage-core – before when integration checks were implemented in distage-framework we did have access to IzLogger there.