zio-logging icon indicating copy to clipboard operation
zio-logging copied to clipboard

Custom Logger not adding annotations

Open fernanluyano opened this issue 1 year ago • 1 comments

I'm following this doc for creating a custom logger. However, I noticed that custom log annotations are not present in the "annotations" field: the map is always empty. When creating a console or file logger (built-in), the custom annotations is present as expected. https://zio.dev/guides/tutorials/create-custom-logger-for-a-zio-application/#creating-a-custom-logger

zio.Runtime.removeDefaultLoggers >>> (SLF4J.slf4j ++ zio.Runtime.addLogger(SnsLogger.LOGGER))
...
val LOGGER: ZLogger[String, Unit] =
    new ZLogger[String, Unit] {
      override def apply(
                          trace: Trace,
                          fiberId: FiberId,
                          logLevel: LogLevel,
                          message: () => String,
                          cause: Cause[Any],
                          context: FiberRefs,
                          spans: List[LogSpan],
                          annotations: Map[String, String] // always empty
                        ): Unit = {
...
}

fernanluyano avatar Mar 18 '24 21:03 fernanluyano

hi @fernanluyano, are you able to create small reproducer? Thanks

justcoon avatar Mar 24 '24 19:03 justcoon