improve print_log()
fix UnboundLocalError from an empty POST