void ILogger.Log(LogItem item) { addLogItem(Log, item); }
private static void addLogItem(ObservableCollection<LogItem> log, LogItem item) { // taking unit tests into account (Application.Current is null there) if (Application.Current != null && Application.Current.Dispatcher != null) { Action action = () => log.Add(item); Application.Current.Dispatcher.Invoke(action); } else { log.Add(item); } }
public void Log(LogItem item) { Console.WriteLine(item.Severity + ": " + item.Message); }