sup has a log4cats module:

libraryDependencies += "com.kubukoz" %% "sup-log4cats" % "0.8.0"


import sup._, sup.modules.log4cats._

What’s included


The log4cats module of sup provides a simple modifier that logs a message before the check and a message with the result of the healthcheck:

import cats._, cats.implicits._, cats.effect._,
import io.chrisdavenport.log4cats.Logger, io.chrisdavenport.log4cats.extras._

val healthCheck: HealthCheck[Id, Id] = HealthCheck.const(Health.Healthy)
// healthCheck: HealthCheck[Id, Id] = sup.HealthCheck$$anon$1@73c8354f

implicit val logger: Logger[Writer[Chain[LogMessage], ?]] = WriterLogger()
// logger: Logger[WriterT[A, Chain[LogMessage], β$0$]] = io.chrisdavenport.log4cats.extras.WriterLogger$$anon$1@11639f9f
val loggedCheck = healthCheck.leftMapK(WriterT.liftK[Id, Chain[LogMessage]]).through(logged("foo"))
// loggedCheck: HealthCheck[WriterT[Id, Chain[LogMessage], V], Id] = sup.HealthCheck$$anon$1@35257607
val (logs, result) =
// logs: List[LogMessage] = List(
//   LogMessage(Debug, None, "Checking health for foo"),
//   LogMessage(Debug, None, "Health result for foo: Healthy")
// )
// result: HealthResult[Id] = HealthResult(Healthy)