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)