logging: add LastError wrapper for GetLastError() call