add logging hook