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

Record file:line of Rerun log call #2963

Open
emilk opened this issue Aug 11, 2023 · 1 comment
Open

Record file:line of Rerun log call #2963

emilk opened this issue Aug 11, 2023 · 1 comment
Labels
🌊 C++ API C/C++ API specific enhancement New feature or request 🐍 Python API Python logging API 🦀 Rust API Rust logging API

Comments

@emilk
Copy link
Member

emilk commented Aug 11, 2023

When user logs some data with Rerun we should log the file:line of that log call.

A user could use this to figure out where a log call came from. For instance, they may see an image in Rerun and wonder where in their source code that was logged.

When a user misuses Rerun we could also tell the user which file:line in their code cause the problem.

How to find the file:line

  • C++: use a RERUN_LOG macro that reads __FILE__ and __LINE__
  • Python: there is certainly some magic for this
  • Rust: Use #[track_caller] and Location::caller()

How to store it

We could have a CallLocation component with the file:line in it.
To save store space we could consider hashing that, and only logging the hash for each log call (except the first one).

@emilk emilk added the enhancement New feature or request label Aug 11, 2023
@emilk emilk changed the title Log file:line of rerun log call Record file:line of Rerun log call Aug 11, 2023
@emilk emilk added 🌊 C++ API C/C++ API specific 🐍 Python API Python logging API 🦀 Rust API Rust logging API labels Aug 11, 2023
@emilk
Copy link
Member Author

emilk commented Oct 31, 2023

For C++20 there is std::source_location, and there might be compiler extensions for earlier C++ versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific enhancement New feature or request 🐍 Python API Python logging API 🦀 Rust API Rust logging API
Projects
None yet
Development

No branches or pull requests

1 participant