smarter --verbose
GoogleCodeExporter opened this issue · comments
we could have a verbose mode where the last verbose message is always visible.
verbose output
while there's already verbose output causes the previous message to be
overwritten. non-verbose
output likewise. so if vogar's busy doing something, you can see the verbose
message, otherwise
they just flash by.
the other use of --verbose is to see what commands were run and sometimes
manually edit/rerun
those commands. i think that use case could probably be better covered by issue
4.
Original issue reported on code.google.com by e...@google.com
on 24 Apr 2010 at 7:51
the use of Logger makes this somewhat awkward. is there any real benefit to
that? it
smells a bit bad to me; look at the way logRecordToString [whose name actually
starts
with a noun, not a verb] both returns a string to be logged but also writes
output to
stdout, textually after the creation of the to-be-logged string, but
dynamically such
that the newline appears first.
why don't we have a singleton Console and send everything straight there? i
think it
would make the existing code simpler, and let us cleanly implement this new
feature.
(even if we decide we don't want this feature, i think losing the logging cruft
would
be a benefit.)
Original comment by elliott....@gmail.com
on 24 Apr 2010 at 10:30
revision 22 pushes all logging into Console, but i'll wait to hear if we need
to
capture java.util.logging output before moving away from java.util.logging
there.
Original comment by elliott....@gmail.com
on 24 Apr 2010 at 11:13
here's the change necessary for "smart verbose" at this point:
lithium:~/Projects/vogar$ svn diff
Index: src/vogar/Console.java
===================================================================
--- src/vogar/Console.java (revision 22)
+++ src/vogar/Console.java (working copy)
@@ -79,7 +79,10 @@
}
public void verbose(String s) {
- Logger.getLogger("vogar").fine("verbose: " + s);
+ newLine();
+ System.out.print(s);
+ System.out.flush();
+ currentLine = CurrentLine.VERBOSE;
}
public void warning(String s) {
@@ -205,6 +208,10 @@
private void newLine() {
if (currentLine == CurrentLine.NEW) {
return;
+ } else if (currentLine == CurrentLine.VERBOSE) {
+ eraseCurrentLine();
+ currentLine = CurrentLine.NEW;
+ return;
}
System.out.println();
@@ -234,6 +241,11 @@
* separators or indentation.
*/
NAME,
+
+ /**
+ * The line contains verbose output, and may be overwritten.
+ */
+ VERBOSE,
}
/**
@@ -251,4 +263,9 @@
private String red(String message) {
return color ? ("\u001b[31;1m" + message + "\u001b[0m") : message;
}
+
+ private void eraseCurrentLine() {
+ System.out.print(color ? "\u001b[2K\r" : "\n");
+ System.out.flush();
+ }
}
lithium:~/Projects/vogar$
Original comment by elliott....@gmail.com
on 24 Apr 2010 at 11:22
Sweeeet. Ever since we added Console I was thinking that Logger was more pain
than it was worth.
Original comment by jessewil...@google.com
on 25 Apr 2010 at 7:20
fixed by revision 23.
Original comment by elliott....@gmail.com
on 25 Apr 2010 at 6:30
- Changed state: Fixed