improved logger and hooks