adds logging middleware