In the U.S., a common course of action is that a peace officer makes an arrest on an alleged violation of law, which is then heard by a magistrate/court. How is the process different if a court witnesses a violation of law? Let's consider an example:
A man is in the courtroom and batters another citizen in the room, observed by the judge.
Is this man charged by the peace officers in the courtroom, or the judge? If the man is directly charged by the judge, is there then a separate hearing where the judge appears as a witness? Lastly, in the case of a Contempt of Court charge, is this charge applied by law enforcement or the court itself? Does it have a separate hearing or does the judge have the ability to perform a direct sentence since the law violation occurred in his/her presence?