public static void BeginRequest(string msg, object request, string tripID = null) { lock (locker) { object thread = System.Threading.Thread.CurrentThread.ManagedThreadId; if (requestLog == null || (threadsEnabled.ContainsKey(thread) && !threadsEnabled[thread])) { return; } if (!requestLog.ContainsKey(thread)) { var json = ""; if (request != null) { json = JsonSerializer.SerializeToString(request); } requestLog[thread] = new RequestLog(json, tripID); numBegunRequests[thread] = 0; } if (!numBegunRequests.ContainsKey(thread)) { numBegunRequests[thread] = 0; } numBegunRequests[thread] = numBegunRequests[thread] + 1; threadsEnabled[thread] = true; Logger.Log(msg, request); Logger.Tab(); } }