sup has a log4cats module:

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

Imports:

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

What’s included

logged

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._, cats.data._
// import cats._
// import cats.implicits._
// import cats.effect._
// import cats.data._

import io.chrisdavenport.log4cats.Logger, io.chrisdavenport.log4cats.extras._
// import io.chrisdavenport.log4cats.Logger
// import io.chrisdavenport.log4cats.extras._

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

implicit val logger: Logger[Writer[Chain[LogMessage], ?]] = WriterLogger()
// logger: io.chrisdavenport.log4cats.Logger[[β$0$]cats.data.WriterT[[A]A,cats.data.Chain[io.chrisdavenport.log4cats.extras.LogMessage],β$0$]] = io.chrisdavenport.log4cats.extras.WriterLogger$$anon$1@29742708

val loggedCheck = healthCheck.leftMapK(WriterT.liftK[Id, Chain[LogMessage]]).through(logged("foo"))
// loggedCheck: sup.HealthCheck[[V]cats.data.WriterT[cats.Id,cats.data.Chain[io.chrisdavenport.log4cats.extras.LogMessage],V],cats.Id] = sup.HealthCheck$$anon$1@6afe11ca

val (logs, result) = loggedCheck.check.run
// logs: cats.data.Chain[io.chrisdavenport.log4cats.extras.LogMessage] = Chain(LogMessage(Debug,None,Checking health for foo), LogMessage(Debug,None,Health result for foo: Healthy))
// result: sup.HealthResult[cats.Id] = HealthResult(Healthy)