The Chofetz Chaim quotes Rabbeinu Yona in his Shaarei Teshuva (219) that a person ideally should not even tell a Jewish court even if he testifies with another witness about someone else’s wrong doing if there is nothing that could be done about it. Rather the one who saw the wrong doing should go over to the transgressor and gently reprimand him in a fashion where it is likely that he will listen to you and try not to commit the sin again. There are circumstances where one should tell a Jewish court of wrongdoing like I’m circumstances where the court can take action to fix the problem, for example a robbery, any other monetary issue or injuries that could be compensated for. However because nowadays the Jewish courts cannot give Torah level lashes or capital punishment then transgresses line incense, or eating pig and shellfish or the like which doesn’t affect anyone else besides sinning against Hashem should certainly not be told to anyone in particular, that would constitute lashon hara/slander but even to inform the courts ideally is not good because we should assume this guy who is a middle of the road guy not necessarily very righteous but not a very bad person who purposely spited G-d, had remorse for his bad deed and hopefully repented. However the Chofetz Chaim does say there is one benefit that could be had by informing the court, in court as official testimony, but not just informing a judge outside of court which is no different than telling anyone else, that is if he did transgress a sin which most Jews no to be wrong then he is invalid to testify as a witness or to swear in court therefore if the court is informed of this person’s misdeeds they know not to accept him as a witness until they know for a fact that he has repented. Other than in court where it is official no one can believe he definitely did the sinful act if they heard about it second hand but they can only suspect misdeed.