Fix traceback in format_log

format_log assumes that if the first value it sees in the changes dict
is a dict with a key 'new', that the information in the changes dict is
from a pkg state. However, this causes format_log to traceback (and
causes the state to output nothing) when the changes dict contains mixed
data. This commit uses a more precise method of determining if the
changes dict contains information from a pkg state. It checks to see
that all values in the changes dict are dicts themselves, and that all
of these sub-dicts contain both "new" and "old" keys. Technically, this
is not a perfect solution since someone could write a state which
returns changes in a similar format, but it at least gets rid of the
traceback.