/// <inheritdoc /> protected override void LogImpl(LogSeverity severity, string message, ExceptionData exceptionData) { lock (console.SyncRoot) { bool oldFooterVisible = console.FooterVisible; try { console.FooterVisible = false; if (!console.IsRedirected) { switch (severity) { case LogSeverity.Error: console.ForegroundColor = ConsoleColor.Red; break; case LogSeverity.Warning: console.ForegroundColor = ConsoleColor.Yellow; break; case LogSeverity.Important: console.ForegroundColor = ConsoleColor.White; break; case LogSeverity.Info: console.ForegroundColor = ConsoleColor.Gray; break; case LogSeverity.Debug: console.ForegroundColor = ConsoleColor.DarkGray; break; } } console.WriteLine(message); if (exceptionData != null) { console.WriteLine(Indent(exceptionData.ToString())); } if (!console.IsRedirected) { console.ResetColor(); } } finally { console.FooterVisible = oldFooterVisible; } } }
private void ShowTaskBeginningBanner() { // Just print the task name once. if (!bannerPrinted) { width = console.Width; console.ForegroundColor = ConsoleColor.White; console.WriteLine(StringUtils.TruncateWithEllipsis(ProgressMonitor.TaskName, width - 1)); console.ResetColor(); bannerPrinted = true; } }
/// <summary> /// Displays an error message to the console. /// </summary> /// <param name="message">The error message.</param> protected virtual void ShowErrorMessage(string message) { console.ForegroundColor = ConsoleColor.Red; console.WriteLine(String.Format("Error: {0}", message)); console.ResetColor(); console.WriteLine(); }