Implement logging (fixes #8)