Refactor logs piping.