<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dump_json(json_info, json_file, overwrite=True):
 """Dump a whole json record into the given file. Overwrite the file if the overwrite flag set. Args: json_info (dict):
 Information dict to be dumped. json_file (str):
 File path to be dumped to. overwrite(boolean) """

    if overwrite:
        mode = "w"
    else:
        mode = "w+"

    try:
        with open(json_file, mode) as f:
            f.write(json.dumps(json_info))
    except BaseException as e:
        logging.error(e.message)