use blocks for logging, fix reconnect attempts, add tests
Merge pull request #12 from nkeyes/fix-reconnect-attempt

use blocks for logging, fix reconnect attempts, add tests