Move logging outside of mutex