Consolidate querying the log into 1 function