Replace printf with log