logger middleware to new structure