Log a message using printf-style formatting. Tries to use appropriate platform-specific functionality where necessary to make sure output goes somewhere that it can be seen.