using Microsoft.Extensions.Logging;
using RestSharp;
using System.Diagnostics;

namespace EVCB_OCPP.WSServer.Service
{
    public class GoogleGetTimePrintService
    {
        private readonly ILogger<GoogleGetTimePrintService> logger;

        public GoogleGetTimePrintService(ILogger<GoogleGetTimePrintService> logger)
        {
            this.logger = logger;
        }

        public async Task Print()
        {
            var client = new RestClient("http://www.google.com");
            var stopWatch = Stopwatch.StartNew();
            await client.ExecuteAsync(new RestRequest("",method: Method.Get));
            stopWatch.Stop();
            logger.LogInformation($"Google Get Cost {stopWatch.ElapsedMilliseconds}ms");
        }
    }
}
