Move util.debug and util.log_error to logging module