Consolidate logging logic in handlers.