Baeldung/scala-tutorials

Console.printLine in ModulePatternExample example not output

jamesboya opened this issue · 3 comments

This tutorial really help me to understand how to construct ZLayer code. However, seems that the Console.printLine in the Logging layer did not really output. Could I know whether I need further configuration?

_ <- Console.printLine(s"$current--$line").orDie

// build.sbt
val scala3Version = "3.3.1"

lazy val root = project
  .in(file("."))
  .settings(
    name := "foo",
    version := "0.1.0-SNAPSHOT",

    scalaVersion := scala3Version,

    libraryDependencies += "dev.zio" %% "zio" % "2.0.20",
    libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test
  )

Hey, @jamesboya.

Please add a link to the tutorial you followed so we can take a look.

Hi, @ulisseslima,

I'm follow the GitHub link of this tutorial. Then find out the example for module pattern with ZLayer.

Hi @jamesboya
Thanks for reporting this. This was a regression while migrating to ZIO 2. We should have used serviceWithZIO instead of serviceWith. The code is fixed and all the logs are getting printed.
Here is the change.