added logging middleware