using Microsoft.Extensions.Logging; using RestSharp; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EVCB_OCPP.WSServer.Service { public class GoogleGetTimePrintService { private readonly ILogger logger; public GoogleGetTimePrintService(ILogger 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"); } } }