logging middleware can pre-process requests and responses