Skip to content
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

Add source location information to log messages #1906

Open
bradallred opened this issue Sep 6, 2023 · 3 comments
Open

Add source location information to log messages #1906

bradallred opened this issue Sep 6, 2023 · 3 comments
Labels
enhancement for features beyond the original's capabilities

Comments

@bradallred
Copy link
Member

bradallred commented Sep 6, 2023

Log messages are queued so you have to search the code for the non variable bits to locate their origin.

We should add something like std::source_location to attach that information. __FILE__ and __LINE__ macros can do this since std::source_location is C++20.

This should probably only be put into debug builds to keep pollution down.

Originally posted by @bradallred in #1900 (comment)

@bradallred bradallred added the enhancement for features beyond the original's capabilities label Sep 6, 2023
@lynxlynxlynx
Copy link
Member

I don't see what's there to gain, the backtrace was clear once the main thread was printed.

@bradallred
Copy link
Member Author

It's just small effort that can help in certain situations. The logging happens on another thread it's not always going to be clear since we currently have 2 threads that can continue executing before the message is even processed. The number of threads is only likely to grow.

@lynxlynxlynx
Copy link
Member

All the important work is done by the main thread, so it still seems like a wild hypothetical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement for features beyond the original's capabilities
Projects
None yet
Development

No branches or pull requests

2 participants