Added middleware for logging