Refactored logging workflow into tests