In a large pot, heat up olive oil and sliced onions on medium heat. Add garlic, sugar, thyme, salt and pepper. Cook the onions covered for 30-40 minutes until they caramelize.
Add the red wine (after 30-40 minutes). Bring to a boil, then reduce the heat and simmer until the wine has evaporated, (about 5 minutes).
Sprinkle the onions flour and give them a stir. Turn the heat down to medium low and cook for 5 minutes.
Add the broth and sliced mushrooms, bring the soup back to a simmer, and cook for 10 minutes.
Season, to taste, with salt and pepper.
When the soup is done, toast bread slices in the oven with sliced swiss or gruyere until cheese melts. Also consider sprinkling 1-2 Tbsp of shredded cheese on top of the soup as a tasty garnish that will melt into the soup. Enjoy!