add debug option, log end event