Sefer Chofetz Chaim Chapter 4, halacha 5, note 25-28 and halacha 6

Note 25: Though the Chofetz Chaim said that when the court reprimands a person that committed a severe sin once they should do it in private and in a fashion that won’t embarrass the guy however he elaborated here that if the guy won’t easily listen or if the sin was public and everyone knows about it and might do the same then the Jewish court has a right to take things into their own hands and use him as an example to dissuade others from committing the same thing or give him lashes to be sure he will stop doing the sin himself.

Note 26: Though the court can’t accept one witness’s testimony for it is considered lashon hara if not said with another witness and they don’t have to rebuke the would be sinner, however if they somehow verified that the he did actually sin then they certainly should rebuke him.

Note 27, 28: In the end of the halacha we said that the person who saw someone do a severe sin can tell the sinner’s rabbi or rebbe as long as he believes him like two witnesses and the rabbi is a secretive and modest person who wouldn’t tell anyone else about it. Then the Rabbi can “hate” the sinner for what he did even if you don’t think he will do it again, until he has proven that he has repented then we assume that this type of rabbi when finding out that his student or congregant has repented or he helps him repent will love the repented sinner again and treat like everyone else as he was before the sin. He certainly won’t tell anyone else, which no one should believe him anyways even if he is a trusted rabbi since I’m this is all second hand coming from him and he only trust the guy who saw the sin first hand “like” two witnesses just to be extra cautious and to try to help the sinner mend his ways.

In halacha 6 the Chofetz Chaim says that even if the rabbi is a big talker but if you know if you don’t say anything to him and he is the only person the sinner will listen to them you are allowed to tell the rabbi in order so that the sinner will stop doing the sin if you have indications that he is ready and willing to do the sin again. This is permissible because you are doing this for the sake of Heaven to stop sin in the world. You certainly can’t tell anyone else because you have not actually seen him sin again even if you saw the sin with someone else, to be two witnesses and you know he would do it again, but as long as you have not seen him do it again or really for multiple times he is still included in the verse of “your nation” which one cannot speak lashon hara to anyone about.