def METHOD_NAME(out_dict, time_of_event, env):
    global last_dt_dir_name
    global last_out_filename
    time_str = time_of_event.strftime("%Y-%m-%d-%H-%M-%S")
    dt_dir_name = time_of_event.strftime(OUTPUT_DT_DIR_FORMAT)
    if dt_dir_name == last_dt_dir_name:
        out_filename = last_out_filename
    else:
        out_filename = (
            OUTPUT_DIR_PATH
            + "/events-"
            + env
            + "-perf-mon"
            + "/"
            + dt_dir_name
            + OUTPUT_FILE_PREFIX
            + env
            + OUTPUT_FILE_POSTFIX
            + time_str
            + "-"
            + str(uuid.uuid1())
        )
    print(
        "- Appending to OUTFILE:  ", out_filename
    )  # lgtm [py/clear-text-logging-sensitive-data]
    # Make directories in path, if they don't exist.
    if not os.path.exists(os.path.dirname(out_filename)):
        try:
            os.makedirs(os.path.dirname(out_filename))
        except OSError as exc:  # Guard against race condition
            if exc.errno != errno.EEXIST:
                raise
    with open(out_filename, "a") as f:
        json.dump(out_dict, f)
        f.write("\n")
    # Keep track of previous file for appending multiple json events in same file
    last_dt_dir_name = dt_dir_name
    last_out_filename = out_filename