code: def do_handle_log(self, workunit, level, *msg_elements):
      
  
      entry_info = {
        'level': self._log_level_str[level],
        'messages': self._render_messages(*msg_elements),
      }
  
      root_id = str(workunit.root().id)
      current_stack = self._root_id_to_workunit_stack[root_id]
      if current_stack:
        current_stack[-1]['log_entries'].append(entry_info)
      else:
        self.results[root_id]['log_entries'].append(entry_info)
docs: Implementation of Reporter callback.