private Task LogAsync(Exception ex, int startTime) { return(Task.Run(() => { var errorTransactionLog = new Transaction { Environment = ApplicationEnvironment, Version = Version, ResponseCode = "Error", IsSuccess = false, TransactionDate = DateTime.Now, Metric = new Metric { ConsecutiveHitCount = FailureHitCount, TotalExecution = Environment.TickCount - startTime }, Exception = ex }; _esClient.IndexAsync(errorTransactionLog); })); }
private async Task <object> LogAsync(Transaction transaction) { var res = await _esClient.IndexAsync(transaction); return(res); }