On the contrary, these are very good reasons to continue breastfeeding. Switching to formula could make the situation worse, not better.
One thing that is frequently forgotten is that breastfeeding helps console and reassure a sick baby. When the baby takes the breast, he will frequently relax and feel better. This healing aspect of breastfeeding shouldn't be overlooked.