Moving log statement after variable is assigned