Implement logging (fixes #7)