In terms of a sage who is G-d fearing one certainly cannot divulge to anyone an obvious sin that you saw him do or even think ill of him because without a doubt he realized he did something wrong, had deep bitter remorse and has repented. The Sefer Yad Hakatana goes so far as to say that you cannot even rebuke him which the Chofetz Chaim qualifies that’s only could be true on the day after but there still is a mitzvah even for a student to rebuke his Rebbe respectfully at the time he sees him do something wrong. Also if it was a sin of monetary matters one can rebuke a G-d fearing sage until he gives back the money. However the Chofetz Chaim doesn’t understand why the Yad HaKetana says there is no mitzvah to rebuke because granted we have to judge him favorably but we wouldn’t say he is able to testify as a witness if he would have committed a sin wish would invalidate him from testifying until the judges know for sure that he repented, assuming isn’t enough when it comes to testimony and it assuming should just remove a positive mitzvah of rebuke.
The Chofetz Chaim in his note at the end of halacha 4 says that up until now we are dealing with transgressions that if told to anyone had no ramifications in this day and age. However in a case of a woman who committed adultery one must tell the husband because the husband is forbidden to stay married to her. However you only have a right to tell the husband if you saw the act firsthand not by hearsay. Also you can only tell him if he will believe you like two witnesses and separate himself from his wife. You can’t even tell him who the adulterer is because there is no point in telling the husband, therefore it is lashon hara unless divulging the name will convince him to separate from his wife. Other than that, if the husband won’t listen to you or anyone else then you can’t even tell the court of what you saw because they can’t do anything about it if the husband won’t believe anyone.