GithubHelp home page GithubHelp logo

Comments (7)

eikek avatar eikek commented on June 16, 2024 1

I can confirm it fixes my issue, thanks!

from scribe.

darkfrog26 avatar darkfrog26 commented on June 16, 2024

Can you show some code that reproduces the problem?

from scribe.

eikek avatar eikek commented on June 16, 2024

Sure, sorry. I might very well have misconfigured something. I'll try to create a minimum example.

from scribe.

hindog avatar hindog commented on June 16, 2024

I just hit this issue while integrating Scribe into another framework (ZIO). In my case, I adapt each ZIO log to a Scribe LogRecord and pass ZIO's fiber-local LogContext map as the data parameter, but the values aren't coming through. Here's an example to demonstrate the issue:

import scribe._
import scribe.data.MDC

object LogExample extends App{

  MDC.update("key1", "value1")

  log(LogRecord(
    Level.Info,
    Level.Info.value,
    new LazyMessage(() => "Some message"),
    implicitly[Loggable[String]],
    None,
    "file.scala",
    "Class",
    None,
    None,
    None,
    data = Map(
      "key2" -> (() => "value2")
    )
  ))
}

# prints:
2022.05.19 18:04:39:660 [main      ] [INFO ] Class - Some message (key1: value1)

# expected:
2022.05.19 18:04:39:660 [main      ] [INFO ] Class - Some message (key1: value1, key2: value2)

I think @eikek has the right idea, the code seems like it should be something like this:

 val map = MDC.map ++ record.data 
 if (map.nonEmpty) { 
   new TextOutput(map.map {   // map includes both sources vs just the MDC map

from scribe.

eikek avatar eikek commented on June 16, 2024

Sorry I forgot to respond - thank you for the example @hindog 🙏🏼

from scribe.

darkfrog26 avatar darkfrog26 commented on June 16, 2024

Thanks for the code example. I'll take a look at this and get back to you ASAP.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 16, 2024

Okay, this is fixed and I'm doing a release now for 3.8.3 that will include it.

from scribe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.