When a crime is committed in the presence of a judge or magistrate, the judge or magistrate may, by an oral or written order, command any person to arrest the offender, and may immediately proceed as though the offender had been brought before the court on a warrant of arrest.