This is a Scala library to print the log in JSON format
Add the following dependency to you build.sbt
libraryDependencies += "io.github.sjmyuan" %% "jlogger" % "0.0.2",
import io.github.sjmyuan.jlogger.SimpleJsonLogger
import cats.effect.IO
import cats.effect.IOApp
import org.slf4j.LoggerFactory
object App extends IOApp {
val logger = new Self4jJsonLogger[IO](LoggerFactory.getLogger(getClass()))
val program = for {
_ <-logger.warn("This is a json logger")
_ <-logger.error("This is a json logger")
_ <-logger.info("This is a json logger")
} yield()
program.unsafeRunSync()
}
import io.github.sjmyuan.jlogger.SimpleJsonLogger
import cats.effect.IO
import cats.effect.IOApp
object App extends IOApp {
val logger = new SimpleJsonLogger[IO]()
val program = for {
_ <-logger.warn("This is a json logger")
_ <-logger.error("This is a json logger")
_ <-logger.info("This is a json logger")
} yield()
program.unsafeRunSync()
}