All judges or magistrates, when authorized by law to grant bail, shall take care that every prisoner in jail shall have an opportunity to give bail in cases in which a prisoner is entitled to bail. Any judge or magistrate, when authorized by law to grant bail, may approve any bond presented to him at any time, which in his judgment is reasonably good, and may, in his discretion, release on his own recognizance any prisoner charged with a misdemeanor.