Refactor logging code
Remove unnecessary prototype for Log()
Initialize Winsock API using INITIALIZE_ONCE

fixes #7413
Implement platform-independent wrapper for poll()