Sometimes I perform some calculations, export the results and a week later I notice something odd with one of the exported files. I still keep the notebooks with the calculations but sometimes certain code has been erased and replaced with other code and it's hard to trace what happened.
So I wondered: is there a way to let Mathematica generate some sort of log file that logs the input that it evaluates. I don't want output and I don't want any expansions of input in the log file for otherwise it could become very large and take too much time to generate it.
For example if I wrote and evaluated the following snippets of code
largedata = Import[...];
myFun[ data_, ... ] := ...
foo = myFun[ largeData ]
(Whoops, large output and incorrect as well... Lets redefine myFun, be sloppy with lingering definitions, names, etc...)
myFun[ data_ ] := ...; foo2 = myFun[ largedata ]; Export[ ..., foo, ... ];
(I feel experimental and write a piece of code that should be faster but it's time for a break and I stop working on it and eventually just leave it there without evaluating)
myFun2[ data_ ] := ....
Then I would like to have a log file (either as part of the notebook or stored in a directory) that reads
[In1] = largedata = Import[...]; [In2] = myFun[ data_, ... ] := ... [In3] = foo = myFun[ largeData ] [In4] = myFun[ data_ ] := ...; foo2 = myFun[ largedata ]; Export[ ..., foo, ... ];