#learning `tracing`
22 messages · Page 1 of 1 (latest)
the error I'm getting is something like, "type doesn't implement tracing::Value"
but this appears to be a sealed trait
Implementing Debug should be enough. Value has the necessary blanket impl.
Do you need to Serialize for some other purpose than tracing? Because if not, just implement Debug directly.
yes. I'm using the json feature and I want the fields to be serialized
I'd implement Debug manually and leverage Serialize by encoding to String
but that doesn't give me correct output
I don't want a string with a JSON serialized object inside, I just want that object
it almost feels like I just need to access the members separately rather than being able to pass the struct to the macros
which is annoying
Why did you bring up Serialize then? Just implement Debug with whatever you want to show
Ah.. it's slowly sinking in
Manually implement Debug and serialize the members
So yes, if "the macros" means the derive part, you are right. Can't use it to get exactly what you want.
But tracing macros should work once you took care of Debug
because writing a struct as JSON would require serialization
"the macros" means the tracing macros like info!
{"timestamp":"2023-03-05T01:18:39.114144Z","level":"INFO","fields":{"server":"Server(Server { socket_addr: 127.0.0.1:5502 }, 127.0.0.1:5502)"},"target":"server"}
Do you know what I meant when I said "manually implement Debug"?
do you know what "I don't want JSON in a string" meant?
wow okay let's stop here. It was an honest question meant to help.