internal static void OnLogChange(string message) { Log = message; bool isNewMessage = LogHash.Add(message); switch (LogMode) { case LogModeEnum.Muted: break; case LogModeEnum.Filtered: if (isNewMessage) { LogChange?.Invoke(Log); } break; case LogModeEnum.Unfiltered: LogChange?.Invoke(Log); break; default: throw new ArgumentException(); } }
internal static void OnLogChange(string key, string value, bool isQuery) { Log = isQuery ? string.Concat("Query - key ", key, ", parameter name ", value): string.Concat("Answer - key ", key, ", value ", value); LogChange?.Invoke(Log); }
public static void SetLog(string log) { LogChange?.Invoke(log); string writePath = System.IO.Directory.GetCurrentDirectory() + @"\Log.txt"; try { using (StreamWriter sw = new StreamWriter(writePath, true, System.Text.Encoding.Default)) { sw.WriteLine(DateTime.Now + "| " + log); } } catch { } }