Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZLogAnnotation with scala 3 enum #1321

Open
mev42 opened this issue Aug 13, 2024 · 0 comments
Open

ZLogAnnotation with scala 3 enum #1321

mev42 opened this issue Aug 13, 2024 · 0 comments

Comments

@mev42
Copy link

mev42 commented Aug 13, 2024

Scala 3 enum logged as {}

import zio.*
import tofu.logging.zlogs.{TofuZLogger, ZLogAnnotation}
import tofu.logging.derivation.loggable.autoDerived

object ExampleApp extends ZIOAppDefault {

  override val bootstrap =
    Runtime.removeDefaultLoggers >>> TofuZLogger.addToRuntime >>> ZLayer(ZIO.logInfo("scala 3"))

  enum Example:
    case Foo, Bar

  case class MyLog(message: String, enum3: Example)

  val zla: ZLogAnnotation[MyLog] = ZLogAnnotation.make[MyLog]("myLog")

  override def run =
    ZIO.logInfo("test") @@ zla(MyLog("test", Example.Bar))
}

{"message":"test","myLog":{"message":"test","enum3":{}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant