Feature Request: thread_id #313
Unanswered
breezewish
asked this question in
Q&A
Replies: 1 comment
-
I believe this should be possible through the use of the The following code should create a new child logger. The new child will have a "thread_id" key in its context, computed by the let child = parent.new(o!(
"thread_id" => slog::FnValue(|| {
format!("{:?}", std::thread::current().id())
})
));
// any use of the `child` logger will have `thread_id` as context.
play(&child); You should also be able to modify this to work with the root loger (just move it to the initial Please let me know if this doesn't work |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be great if the thread_id could be printed out, which could be helpful to learn the context in multi-threaded applications.
Beta Was this translation helpful? Give feedback.
All reactions