log a message before and after an event function