I was playing with nrf51 dongle some more and I stumbled on some troubles, so debugging would be handy. After some playing around I found out you need to add following to Makefile:
After that you just use whatever you need for debugging in the code (e.g. printf).
The result can be read on serial terminal over the USB port (e.g. minicom). You need to set the speed to 38400).