Use message logging function instead of fprintf.