Add data logging functions.
Merge remote-tracking branch 'upstream/master'