Formality: It is considered a literary idiom (成语), so it's more formal than slang, but its subject matter means it's most often used in informal contexts like gossip, social media commentary, and tabloid news. You would not use it in a serious academic or legal document, where a term like
婚外情 (hūn wài qíng) would be preferred.