Add logging and refactor build definition