public static void EndRequest(object response) { lock (locker) { object thread = System.Threading.Thread.CurrentThread.ManagedThreadId; if (requestLog == null || !threadsEnabled.ContainsKey(thread) || (threadsEnabled.ContainsKey(thread) && !threadsEnabled[thread]) || (numBegunRequests.ContainsKey(thread) && numBegunRequests[thread] == 0) ) { return; } Logger.Untab(); if (response != null) { Logger.Log("Response", response); } numBegunRequests[thread] = numBegunRequests[thread] - 1; if (splunkEnabled) { splunkClient.Enqueue(requestLog[thread]); } if (numBegunRequests[thread] == 0) { Logger.AddTag("Type", "INFO"); Logger.AddTag("Memory", (System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString() + "Mb"); var json = ""; if (response != null) { json = JsonSerializer.SerializeToString(response); } requestLog[thread].Response = json; if (splunkEnabled) { splunkClient.Enqueue(requestLog[thread]); Queue.Enqueue(requestLog[thread]); } requestLog.Remove(thread); numBegunRequests.Remove(thread); } } }