Index: utils/pub/log.dart |
diff --git a/utils/pub/log.dart b/utils/pub/log.dart |
index ec3fee9798944e586b359b1a0ab0891f78f8d0e0..eb414492545b7a1cbb3e71cec9b7d676d657b1c9 100644 |
--- a/utils/pub/log.dart |
+++ b/utils/pub/log.dart |
@@ -36,6 +36,9 @@ class Level { |
/// operation, process spawning, or file IO. |
static const IO = const Level._("IO "); |
+ /// Incremental output during pub's version constraint solver. |
+ static const SOLVER = const Level._("SLVR"); |
+ |
/// Fine-grained and verbose additional information. Can be used to provide |
/// program state context for other logs (such as what pub was doing when an |
/// IO operation occurred) or just more detail for an operation. |
@@ -56,6 +59,9 @@ class Entry { |
Entry(this.level, this.lines); |
} |
+/// Returns `true` if [level] is being recorded in some way. |
+bool isEnabled(Level level) => _loggers != null && _loggers[level] != null; |
+ |
/// Logs [message] at [Level.ERROR]. |
void error(message) => write(Level.ERROR, message); |
@@ -68,6 +74,9 @@ void message(message) => write(Level.MESSAGE, message); |
/// Logs [message] at [Level.IO]. |
void io(message) => write(Level.IO, message); |
+/// Logs [message] at [Level.SOLVER]. |
+void solver(message) => write(Level.SOLVER, message); |
+ |
/// Logs [message] at [Level.FINE]. |
void fine(message) => write(Level.FINE, message); |
@@ -168,6 +177,7 @@ void showNormal() { |
_loggers[Level.WARNING] = _logToStderr; |
_loggers[Level.MESSAGE] = _logToStdout; |
_loggers[Level.IO] = null; |
+ _loggers[Level.SOLVER] = null; |
_loggers[Level.FINE] = null; |
} |
@@ -178,6 +188,18 @@ void showIO() { |
_loggers[Level.WARNING] = _logToStderrWithLabel; |
_loggers[Level.MESSAGE] = _logToStdoutWithLabel; |
_loggers[Level.IO] = _logToStderrWithLabel; |
+ _loggers[Level.SOLVER] = null; |
+ _loggers[Level.FINE] = null; |
+} |
+ |
+/// Sets the verbosity to "solver", which shows errors, warnings, messages, and |
+/// solver logs. |
+void showSolver() { |
+ _loggers[Level.ERROR] = _logToStderr; |
+ _loggers[Level.WARNING] = _logToStderr; |
+ _loggers[Level.MESSAGE] = _logToStdout; |
+ _loggers[Level.IO] = null; |
+ _loggers[Level.SOLVER] = _logToStdout; |
_loggers[Level.FINE] = null; |
} |
@@ -187,6 +209,7 @@ void showAll() { |
_loggers[Level.WARNING] = _logToStderrWithLabel; |
_loggers[Level.MESSAGE] = _logToStdoutWithLabel; |
_loggers[Level.IO] = _logToStderrWithLabel; |
+ _loggers[Level.SOLVER] = _logToStderrWithLabel; |
_loggers[Level.FINE] = _logToStderrWithLabel; |
} |