lumberjack icon indicating copy to clipboard operation
lumberjack copied to clipboard

Feature request: Add columns to dump_log object before write

Open aecorn opened this issue 3 years ago • 1 comments

Use-case: Add username-column to log-rows to backtrack who made the changes.

Non-working solution, before dump_log(): transform( user = Sys.getenv("USERNAME")) %>>% Results in all user-add-edits being logged, instead of username being added to existing rows in logs.

Better, but verbose solution: After dump, read file back in, add column, write out again.

log_cellwise <- read.csv("log_cellwise.csv")
log_cellwise <- transform(log_cellwise, user = Sys.getenv("USERNAME"))
write.csv(log_cellwise, "log_cellwise.csv")

Are there some "Arguments passed to the dump method of the logger." that can be passed to achieve adding a column before the dump? I would love if something like this was possible: dump_log(data, "cellwise", file ="log.csv", cols = single_value/expression/transform() ) But I can see how it would open a can of worms potentially. Maybe there is some smart set of parameters / methods I am unaware of that could fit?

aecorn avatar May 04 '21 06:05 aecorn

Thank you for the feedback. This seems a useful feature in a multi-user environment. I will take a look if something like a user id, and/or machine name can be added somehow.

markvanderloo avatar May 07 '21 15:05 markvanderloo