def _convert_log_entry(entry): if not isinstance(entry, logmessage.AbstractLogMessage): log_time, log_name, log_data = entry time_raw = log_time[0] * g.seconds_per_day + log_time[1] * g.seconds_per_hour + \ log_time[2] * g.seconds_per_minute + log_time[3] if log_name == 'log_event': entry = logmessage.LogEmittedEvent(time_raw, log_data[0]) else: reason, base_name, base_type_id, location_id = log_data if reason == 'maint': entry = logmessage.LogBaseLostMaintenance(time_raw, base_name, base_type_id, location_id) else: entry = logmessage.LogBaseDiscovered(time_raw, base_name, base_type_id, location_id, reason) return entry
def _convert_log_entry(entry): if not isinstance(entry, logmessage.AbstractLogMessage): log_time, log_name, log_data = entry time_raw = log_time[0] * g.seconds_per_day + log_time[1] * g.seconds_per_hour + \ log_time[2] * g.seconds_per_minute + log_time[3] if log_name == 'log_event': entry = logmessage.LogEmittedEvent(time_raw, log_data[0]) else: if type(log_data) == tuple and len(log_data) != 4: # 0.31pre saves used 3 values tuple. We cannot # restore those so we simply discard them as we # need the "reason" field as well. return None reason, base_name, base_type_id, location_id = log_data if reason == 'maint': entry = logmessage.LogBaseLostMaintenance(time_raw, base_name, base_type_id, location_id) else: entry = logmessage.LogBaseDiscovered(time_raw, base_name, base_type_id, location_id, reason) return entry