@@ -14,8 +14,10 @@ import StringOps.{countElementsAsString => countAs, trimAllTrailingSpace => trim
14
14
15
15
/** This class implements a Reporter that displays messages on a text console.
16
16
*/
17
- class ConsoleReporter (val settings : Settings , reader : BufferedReader , writer : PrintWriter ) extends AbstractReporter {
18
- def this (settings : Settings ) = this (settings, Console .in, new PrintWriter (Console .err, true ))
17
+ class ConsoleReporter (val settings : Settings , reader : BufferedReader , writer : PrintWriter , echoWriter : PrintWriter ) extends AbstractReporter {
18
+ def this (settings : Settings ) = this (settings, Console .in, new PrintWriter (Console .err, true ), new PrintWriter (Console .out, true ))
19
+ def this (settings : Settings , reader : BufferedReader , writer : PrintWriter ) =
20
+ this (settings, reader, writer, writer)
19
21
20
22
/** Whether a short file name should be displayed before errors */
21
23
var shortname : Boolean = false
@@ -41,6 +43,12 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr
41
43
writer.flush()
42
44
}
43
45
46
+ /** Prints the message to the echoWriter, which is usually stdout. */
47
+ override def echo (msg : String ): Unit = {
48
+ echoWriter.println(trimTrailing(msg))
49
+ echoWriter.flush()
50
+ }
51
+
44
52
/** Prints the message with the given position indication. */
45
53
def printMessage (posIn : Position , msg : String ): Unit = printMessage(formatMessage(posIn, msg, shortname))
46
54
0 commit comments