Logging in terms of free monads