tlo.logging.reader module

class LogData[source]

Bases: object

Builds up log data for export as dictionary with dataframes

parse_log_line(log_line: str, level: int)[source]

Parse LogRow at desired level

Parameters:
  • log_line – a json line from log file that can either be a header or data row

  • level – matching level to add to log, other levels will not be added

get_log_dataframes() DefaultDict[str, Dict[str, DataFrame]][source]

Converts parsed logs of dictionaries to dataframes and then returns all logs

Returns:

dictionary of output logs with dataframes for each log key

parse_logged_dataframe(values: List[List[Dict[str, Dict[str, Any]]]], dates: List[str]) DataFrame[source]

Converts log data for an entire dataframe being logged into a mutli-indexed dataframe :param values: logged values :param dates: list of dates :return: Multi-indexed (log_row, df_row) dataframe