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

Where should default log go? #16

Open
beanumber opened this issue Oct 22, 2018 · 4 comments
Open

Where should default log go? #16

beanumber opened this issue Oct 22, 2018 · 4 comments

Comments

@beanumber
Copy link
Collaborator

How do we keep track of where the log file goes? At @jennybc 's suggestion I am using rprojroot to find the project directory, but to return the working directory if find_root() fails.

But if somebody just tries to use read_csv(), we can't control whether they are in a project or what the working directory is at the time of the call. So to which log file should that event be written?

Symptom: devtools::test() currently returns 0 errors, but devtools::check() returns 3.

@jennybc
Copy link
Collaborator

jennybc commented Oct 22, 2018

I think I don't understand enough about how fertile is put together and the context for "somebody just tries to use read_csv()" to be helpful at this moment. But maybe it will be more clear after getting an intro in group meeting next week.

@beanumber
Copy link
Collaborator Author

So there are at least two importantly different use cases here:

  1. In interactive mode, you might do:
library(tidyverse)
library(fertile)
read_csv("mydata.csv")
  1. In retrospective mode, you might do:
fertile::has_no_absolute_paths()

In the first case, the read_csv() shim writes this action to a log file. But where is it? Well, by default it looks for the project root and puts it in the log file there.

In the second case, it's pointless to look at the same log file, because that file contains the actions the user made interactively. So we have to render the code in the project (using proj_render()), all the while recording the user actions in a different (clean) log file. But how is the shimmed version of read_csv() supposed to know which log file to write to? It can't be an option to fertile::read_csv() (because no user is ever going to specify that location), so it has to be some kind of global variable.

Right??

So I'm wondering whether fertile should explicitly maintain:

  1. a per-session log file (e.g., file_temp())
  2. a persistent log file that lives in the project root (e.g., maybe just concatenate the per-session log files?)
  3. other per-session log files generated by proj_render()

It's seems likely to me that this is an easy problem to solve, but I just don't understand sessions, environments, and global variables well enough at the moment.

The answer will help with #34.

@jennybc
Copy link
Collaborator

jennybc commented Dec 18, 2018

I continue to not be immersed enough in fertile to have ready and great answers.

But I think another candidate location to have on your radar is ~/.R/fertile, if you end up feeling like something should be recorded but has no natural and specific home.

@beanumber
Copy link
Collaborator Author

@hadley agrees with @jennybc about keeping track of it in a .fertile file somewhere.

Also, possible use Sys.setenv() to keep track of it.

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

No branches or pull requests

2 participants