Skip to content

Log the current task name in the log! macros. #19444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

reem
Copy link
Contributor

@reem reem commented Dec 1, 2014

This requires doing an allocation on log! invocations
if the current task is named, since there is no non-allocating
way to access the name of the current task.

Fixes #2672

This requires doing an allocation on log! invocations
if the current task is named, since there is no non-allocating
way to access the name of the current task.

Fixes rust-lang#2672
@reem
Copy link
Contributor Author

reem commented Dec 1, 2014

Opened #19445 to track the allocation in finding a task's name.

@@ -53,14 +53,15 @@
#[macro_export]
macro_rules! log(
($lvl:expr, $($arg:tt)+) => ({
static LOC: ::log::LogLocation = ::log::LogLocation {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton had me specifically add in this static code, to reduce code generation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Urgh. Initially I tried to keep it, but you can't call ::std::task::name in a static.

@alexcrichton
Copy link
Member

We may not actually wish to push too hard on this design currently in that #2672 is quite an old issue and @aturon is close to removing tasks entirely. We could support the concept of named threads, but I'd want to make sure we're committing to that API in std before pushing that reliance into liblog.

@reem would you be ok holding off on this to see what the resolution is for std::task?

@reem
Copy link
Contributor Author

reem commented Dec 3, 2014

Sure, nothing urgent, just trying to close a triage bug.

@aturon
Copy link
Member

aturon commented Dec 3, 2014

FWIW, I do plan to provide naming support for threads, somewhat like what we currently have with tasks.

@alexcrichton
Copy link
Member

@reem would you mind actually sending this PR to https://github.com/rust-lang/log instead now? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trace task names in logging macros
4 participants