From 7bec7fe823b75029142b07ff0d806ff8cfd6aa5f Mon Sep 17 00:00:00 2001 From: Doron Somech Date: Wed, 9 Oct 2024 22:26:09 +0300 Subject: [PATCH] use ZIO.logAnnotations --- .../src/test/scala/zio/logging/AppendLoggerNameSpec.scala | 8 ++++---- core/shared/src/main/scala/zio/logging/package.scala | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/jvm/src/test/scala/zio/logging/AppendLoggerNameSpec.scala b/core/jvm/src/test/scala/zio/logging/AppendLoggerNameSpec.scala index 67645204..6be5f0d8 100644 --- a/core/jvm/src/test/scala/zio/logging/AppendLoggerNameSpec.scala +++ b/core/jvm/src/test/scala/zio/logging/AppendLoggerNameSpec.scala @@ -2,16 +2,16 @@ package zio.logging import zio.test._ import zio.logging.appendLoggerName -import zio.FiberRef +import zio.ZIO object AppendLoggerNameSpec extends ZIOSpecDefault { val spec: Spec[Environment, Any] = suite("AppendLoggerNameSpec")( test("appendLoggerName") { for { - name <- FiberRef.currentLogAnnotations.get.map(annotations => - annotations.get(loggerNameAnnotationKey) - ) @@ appendLoggerName("logging") @@ appendLoggerName("zio") + name <- ZIO.logAnnotations.map(annotations => annotations.get(loggerNameAnnotationKey)) @@ appendLoggerName( + "logging" + ) @@ appendLoggerName("zio") } yield assertTrue(name == Some("zio.logging")) } diff --git a/core/shared/src/main/scala/zio/logging/package.scala b/core/shared/src/main/scala/zio/logging/package.scala index 6ca7fb5d..d0c0c5dd 100644 --- a/core/shared/src/main/scala/zio/logging/package.scala +++ b/core/shared/src/main/scala/zio/logging/package.scala @@ -64,7 +64,7 @@ package object logging extends LoggerLayers { new ZIOAspect[Nothing, Any, Nothing, Any, Nothing, Any] { def apply[R, E, A](zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A] = for { - annotations <- FiberRef.currentLogAnnotations.get + annotations <- ZIO.logAnnotations currentLoggerName = annotations.get(loggerNameAnnotationKey) newLoggerName = currentLoggerName.fold(value)(currentLoggerName => s"$currentLoggerName.$value") a <- ZIO.logAnnotate(loggerNameAnnotationKey, newLoggerName)(zio)