(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
-c
option 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.
Nice. But not as nice as the Windows® alternative:
1. Create a new .txt file
2. Write .LOG on the first line
3. Save and close.
Every time you open this file in Notepad, the current time and date will be appended.
Cool, I didn’t know you could do that.
But I still think it is more practical to have the log based on days, so everything I did on a specific day will be grouped together. It is much easier to discern what happened yesterday when I just need to read the last block of text, instead of backwards searching through an unknown number of timestamps.
I’m on Windows too, but I like using MS OneNote for logging and organizing notes. I simply press Win+Shift+N and start typing. Here I can tag stuff as important/questions/tasks/etc and search for it later. I organize my logs in pages on a monthly basis, but use no cool automatic date injection feature. I have concluded it doesn’t take me that much effort to type in a two digit day (of the month) anyway. You could of course use a tool like Autohotkey or something and whip up a script for text insertion pretty easily, or as I just discovered press Alt+Shift+F to insert time and date. :)
OneNote sounds quite good.
This is how I keep my TODO-list:

NOK 199,- at Clas Ohslson:
http://www.clasohlson.no/Product/Product.aspx?id=146114387