private static void WriteStatus(LogAggregate agg) { Console.WriteLine($"Status Update - hits = {agg.RollingTotal} at {agg.Occurance}"); foreach (var kvp in agg.Counts.OrderByDescending(k => k.Value).ThenBy(k => k.Key.Length)) { if (kvp.Value > 0) { Console.WriteLine($"{kvp.Key} : {kvp.Value}"); } } Console.WriteLine("--------------------------------------------------"); }
protected void OnAlertCancelled(LogAggregate agg) => AlertCancelled?.Invoke(this, agg);
protected void OnAlertTriggered(LogAggregate agg) => AlertTriggered?.Invoke(this, agg);
protected void OnAggregateProcessed(LogAggregate agg) => AggregateProcessed?.Invoke(this, agg);
private static void WriteAlertCancelled(LogAggregate agg) { Console.WriteLine($"Traffic back to normal - hits = {agg.RollingTotal} at {agg.Occurance}"); }
private static void WriteAlertTriggered(LogAggregate agg) { Console.WriteLine($"High traffic generated an alert - hits = {agg.RollingTotal}, triggered at {agg.Occurance}"); }