Implemented logging

Fixes #98.