Changed cout to logprintf