Modify retry middleware to retry on timeouts multiple times.
User logger instead of printing to stdout.