add debug output

add optional debug flag to print out every hook