change logging to use printf