Open ebuljan opened 3 years ago
Workaround: public static class MemoryLogHelper { public static void ClearLogs() { var field = typeof(MemoryLogger).GetField("logsDictionary", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Instance); Debug.Assert(field != null, nameof(field) + " != null"); var logs = field.GetValue(null) as System.Collections.IDictionary; Debug.Assert(logs != null, nameof(logs) + " != null"); foreach (var value in logs.Values) { Debug.Assert(value != null, nameof(value) + " != null"); var logData = value.GetType().GetField("logList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) ?.GetValue(value) as List<Tuple<DateTime, string>>; Debug.Assert(logData != null, nameof(logData) + " != null"); logData.Clear(); } } }
I don't see a public way to clear the log dictionary. I also don't have access to do a pull request. Can this be added?