cleanup logparser

add comments
better error checking