cleaning up logger middleware to me more self-sufficient