(This post does not concern C++. I continue to post about C++ every Friday, but I will sometimes post about other topics related to software development in between. Feel free to ignore these if you are here for C++ only.)
I have a tendency to forget what I did the previous day on the standups, especially the Monday ones. Also, at the end of the month, I need to send a summary of what I did to my manager, which is even harder. I considered looking for some web based logging software, or maybe setting up a wiki, but I ended up with this really simple solution:
$ cat ~/bin/log
#!/bin/bash
DATE=`date +%Y-%m-%d`
LOGFILE=~/Documents/log.txt
egrep "^$DATE$" $LOGFILE
if [ $? != 0 ]; then
echo $DATE << $LOGFILE
fi
gvim -c ':$' $LOGFILE
Now I can just press Alt+F2 (in Gnome), type log, and the log opens in gvim, with the cursor on the last line. If it is the first time I open the log on a particular day, the current date is automatically appended to the end of the file.
A short explaination of the script:
- 2: Get todays date on the format YYYY-MM-DD
- 4-7: Check if the date has already been inserted into the log-file, if not, append it at the end
- 8: Open gvim. The
-coption lists commands that will be executed after the file is opened.:$places the cursor on the last line in the file.
Finally a simple example of my log:
2010-04-01
Implemented foo
Fixed bug #1337
2010-04-02
Implemented bar
Went too fizzbuzz architecture meeting
Quick, simple, and no dependencies on external services.