Comments (7)
I can confirm it fixes my issue, thanks!
from scribe.
Can you show some code that reproduces the problem?
from scribe.
Sure, sorry. I might very well have misconfigured something. I'll try to create a minimum example.
from scribe.
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.
Sorry I forgot to respond - thank you for the example @hindog 🙏🏼
from scribe.
Thanks for the code example. I'll take a look at this and get back to you ASAP.
from scribe.
Okay, this is fixed and I'm doing a release now for 3.8.3
that will include it.
from scribe.
Related Issues (20)
- Scala JS source maps, map to release dir? HOT 9
- No colours when run on Node.js HOT 14
- TASTy file was produced by Scala 3.2.0 HOT 7
- [Suggestion] improve JSON logging usability HOT 5
- REPL: scribe macro NPE when the scala source file is virtual HOT 2
- Include ISO8601 datetime formatters in core HOT 7
- Logstash encoding for stdout HOT 2
- Exceptions are not logged by SLF4JHelper since 3.9.0 HOT 5
- Unable to have minimumLevel=Info and only enable Trace for certain packages HOT 11
- Overriding the path for log files HOT 4
- Help: configure stdout/stderr in function of LogLevel HOT 15
- Compare perfomance with Chronicle-Logger HOT 2
- NPE when logging with SLF4J and Throwble == null HOT 4
- Different versions of scala-collection-compat pulled in transitively HOT 3
- Logger ignores `data` field HOT 3
- AsynchronousLogHandle shutdown hook HOT 3
- MDC syntax improvement HOT 7
- Standardize JSON output ? HOT 3
- Is it safe to use MDC with cats-effect? HOT 5
- Logging stderr HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scribe.