def merge_logfiles(log1, log2):
    """Merge two log files.

    If log1 overlaps with log2, the overlapping entries in log1
    are discarded.
    """
    first_in_2 = log2['time'][0]
    keep_from_1 = log1['time'] < first_in_2
    for key in log1.keys():
        log1[key] = log1[key][keep_from_1]
    log1.timeseries_append(log2)
    return log1