Created
August 23, 2016 18:59
-
-
Save earino/ee737ed12e90caf739496d90e42565c5 to your computer and use it in GitHub Desktop.
Replace the library() function so it logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (! "old_library" %in% ls()) { | |
old_library <- library | |
} | |
logging_library <- function(...) { | |
cat(as.character(substitute(...)), | |
sep="\n", | |
file="library_log.txt", | |
append=TRUE) | |
return(old_library(...)) | |
} | |
library <- logging_library |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment