Merge "Refactor and improve logging." into oc-dev