private void UpdateHistory(LogEntry logEntry) { if (logEntry.Severity != LogEntrySeverity.Verbose) { _history.Add(logEntry); if (_history.Count > 100) { _history.RemoveAt(0); } } }
private void Publish(LogEntrySeverity type, string message, params object[] parameters) { if (parameters != null && parameters.Any()) { try { message = string.Format(message, parameters); } catch (FormatException) { message = message + " (" + string.Join(",", parameters) + ")"; } } PrintNotification(type, message); // TODO: Refactor to use IHomeAutomationTimer.CurrentDateTime; var logEntry = new LogEntry(_currentId, DateTime.Now, Environment.CurrentManagedThreadId, type, string.Empty, message); lock (_syncRoot) { _items.Add(logEntry); _currentId++; UpdateHistory(logEntry); } }