baumer-lab / fertile

creating optimal conditions for reproducibility
GNU General Public License v3.0
52 stars 4 forks source link

Extract srcref from call stack #12

Open hadley opened 6 years ago

hadley commented 6 years ago

Rough guess of what you need to do:

  1. Use rlang::call_stack() to get list of all calls leading to logging function
  2. Figure out how many levels you need to go back (maybe can do that by looking at a srcrefs so should actually happen after next step)
  3. Extract srcrefs somehow

Also look at rlang::trace_back() which should be capturing the srcrefs

hadley commented 6 years ago

Start by reading https://adv-r.hadley.nz/environments.html#call-stack