tofu.logging.LoggingRepresentableKInstances.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tofu-logging-structured_3 Show documentation
Show all versions of tofu-logging-structured_3 Show documentation
Opinionated set of tools for functional programming in Scala
package tofu.logging
import cats.~>
import tofu.higherKind.{RepresentableK, RepK}
import tofu.logging.Logging.Level
trait LoggingRepresentableKInstances {
// TODO: use higherKind.derived macro when it is ready
given loggingRepresentable: RepresentableK[Logging] = new RepresentableK[Logging] {
def tabulate[F[_]](hom: RepK[Logging, _] ~> F): Logging[F] = new Logging[F] {
def write(level: Level, message: String, values: LoggedValue*): F[Unit] =
hom(RepK[Logging](_.write(level, message, values: _*)))
}
}
}