Back in the day they used to have Hotel Detectives, one of whose key roles were preventing premarital sex or affairs from occurring. I think Hotel Detectives are almost totally gone now, but the attitude of protecting the hotel from scandal hasn't.
"Unlike the private eye, he's not a romantic figure; he's paid by the hour and probably on the take. Maybe he has a little drinking problem. He...turns up. He always has, at least as far back as July 30, 1917, when two New York hotel detectives caught then-senator Warren G. Harding in bed with an underage girl ..."
Because it was posted to HN a few days ago, I checked the Wikipedia category for "Obsolete occupations"[1] to see if this might have been listed, but alas, it wasn't in the cards.
Good point. This character is a staple of many old novels and films -- Arthur Hailey's novel Hotel (1965, adapted as a movie) has such a detective, who is corrupt and mainly wants to extract bribes from any guest who breaks a rule.