Hilchos Lashon Hara chapter 4, section 6

It further appears that a person who will likely repeat the same foolish mistake, if his rabbi is an authoritative person whose words of rebuke will be accepted by the transgressor, it is permitted to disclose his action to him, even if that rabbi is not particularly discrete and the disclosure will become public knowledge. Even if two witnesses watched this person commits a sin, the disclosure can only be made to the city’s judicial authorities and to no one else. Because he has been seen committed a sin only once, and maybe regretted his sin and did Teshuvah, therefore this person is still categorized as “your fellow Jew”.