Added logging function. Support format strings for error messages.
Use OutputDebugString in addition to printf for logging on Windows.
Print newline to correct output.