Added after_dispatch hook for logging