check_treelog function

Check if a treelog is valid.