The sheriff shall have custody of the jail in his county and, if he appoint a jailer to keep it, the sheriff shall be liable for such jailer and the sheriff or jailer shall receive and safely keep in prison any person delivered or committed to either of them, according to law.