Chromium Code Reviews

Unified Diff: sdk/lib/_internal/pub/lib/src/log.dart

Issue 103453005: Show detailed report on upgrade. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: sdk/lib/_internal/pub/lib/src/log.dart
diff --git a/sdk/lib/_internal/pub/lib/src/log.dart b/sdk/lib/_internal/pub/lib/src/log.dart
index 10f220db506fee0165d012d6e9c1532687712880..bcc5b5dbfa4cad3815f9b98867830c9a0f4251e8 100644
--- a/sdk/lib/_internal/pub/lib/src/log.dart
+++ b/sdk/lib/_internal/pub/lib/src/log.dart
@@ -25,10 +25,13 @@ Timer _progressTimer;
/// progress is done, a single entry will be added to the log for it.
String _progressMessage;
+final _cyan = getSpecial('\u001b[36m');
final _green = getSpecial('\u001b[32m');
+final _magenta = getSpecial('\u001b[35m');
final _red = getSpecial('\u001b[31m');
final _yellow = getSpecial('\u001b[33m');
final _none = getSpecial('\u001b[0m');
+final _bold = getSpecial('\u001b[1m');
/// An enum type for defining the different logging levels. By default, [ERROR]
/// and [WARNING] messages are printed to sterr. [MESSAGE] messages are printed
@@ -208,10 +211,22 @@ Future progress(String message, Future callback()) {
return callback().whenComplete(_stopProgress);
}
+/// Wraps [text] in the ANSI escape codes to make it bold when on a platform
+/// that supports that.
+String bold(text) => "$_bold$text$_none";
+
+/// Wraps [text] in the ANSI escape codes to color it cyan when on a platform
+/// that supports that.
+String cyan(text) => "$_cyan$text$_none";
+
/// Wraps [text] in the ANSI escape codes to color it green when on a platform
/// that supports that.
String green(text) => "$_green$text$_none";
+/// Wraps [text] in the ANSI escape codes to color it magenta when on a
+/// platform that supports that.
+String magenta(text) => "$_magenta$text$_none";
+
/// Wraps [text] in the ANSI escape codes to color it red when on a platform
/// that supports that.
String red(text) => "$_red$text$_none";

Powered by Google App Engine