It will help to log errors returned by GetLastError() or WSAGetLastError(): - <https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror> - <https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsagetlasterror> - <https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes#system-error-codes> Always log the errors in English to be able to read them in bug reports.
This will allow to avoid unnecessary processing for creating logs which will be discarded anyway.