protected SimpleLogItem LogItem(SimpleLogItemSeverity severity, String message, String description = null, Exception exception = null) { SimpleLogItem item = CreateItem(severity, message, description, exception); Log.Add(item); return(item); }
private void WriteFooter() { var status = string.Join(", ", _replayList.Select(s => $"{s.Value.Count} {s.Key}(s)")); var logLevel = _replayList.FirstOrDefault(s => s.Value.Count > 0).Key; var header = $"\n\nThere are totally {status}"; var logItem = new SimpleLogItem(logLevel, header, "Build Completed."); foreach (var listener in _listeners) { listener.WriteLine(logItem); } }
private ListViewItem CreateListViewItem(SimpleLogItem item) { ListViewItem lvi = new ListViewItem(new string[] { item.Message, item.Info }); if (item.Level == LogLevel.Error) { lvi.ForeColor = Color.DarkRed; } else if (item.Level == LogLevel.Warning) { lvi.ForeColor = Color.Peru; } else { lvi.ForeColor = Color.Black; } lvi.UseItemStyleForSubItems = true; return(lvi); }
private void WriteHeader() { var logLevel = _replayList.FirstOrDefault(s => s.Value.Count > 0).Key; string message; if (logLevel >= LogLevel.Error) { message = "Build failed."; } else if (logLevel == LogLevel.Warning) { message = "Build succeeded with warning."; } else { message = "Build succeeded."; } var logItem = new SimpleLogItem(logLevel, $"\n\n{message}", null); foreach (var listener in _listeners) { listener.WriteLine(logItem); } }