added hooks in logEvent
rebase :)