@@ -182,7 +182,7 @@ class DefaultReporter(debugSections: Set[DebugSection]) extends Reporter(debugSe
182
182
183
183
def emit (msg : Message ) = synchronized {
184
184
println(reline(severityToPrefix(msg.severity), smartPos(msg.position) + msg.msg.toString))
185
- printLineContent(msg.position)
185
+ printLineContent(msg.position, false )
186
186
}
187
187
188
188
def getLine (pos : Position ): Option [String ] = {
@@ -201,7 +201,7 @@ class DefaultReporter(debugSections: Set[DebugSection]) extends Reporter(debugSe
201
201
202
202
val blankPrefix = " " * prefixSize
203
203
204
- def printLineContent (pos : Position ): Unit = {
204
+ def printLineContent (pos : Position , asciiOnly : Boolean ): Unit = {
205
205
getLine(pos) match {
206
206
case Some (line) =>
207
207
println(blankPrefix+ line)
@@ -218,10 +218,16 @@ class DefaultReporter(debugSections: Set[DebugSection]) extends Reporter(debugSe
218
218
(" ^" * width)+ " ..."
219
219
}
220
220
221
- println(blankPrefix+ (" " * (bp.col - 1 ) + Console .RED + carret+ Console .RESET ))
221
+ if (asciiOnly)
222
+ println(blankPrefix+ (" " * (bp.col - 1 ) + carret))
223
+ else
224
+ println(blankPrefix+ (" " * (bp.col - 1 ) + Console .RED + carret+ Console .RESET ))
222
225
223
226
case op : OffsetPosition =>
224
- println(blankPrefix+ (" " * (op.col - 1 ) + Console .RED + " ^" + Console .RESET ))
227
+ if (asciiOnly)
228
+ println(blankPrefix+ (" " * (op.col - 1 ) + " ^" ))
229
+ else
230
+ println(blankPrefix+ (" " * (op.col - 1 ) + Console .RED + " ^" + Console .RESET ))
225
231
}
226
232
case None =>
227
233
}
@@ -234,12 +240,26 @@ class DefaultReporter(debugSections: Set[DebugSection]) extends Reporter(debugSe
234
240
}
235
241
236
242
class PlainTextReporter (debugSections : Set [DebugSection ]) extends DefaultReporter (debugSections) {
237
- override protected def severityToPrefix (sev : Severity ): String = sev match {
238
- case ERROR => " [ Error ]"
239
- case WARNING => " [Warning ]"
240
- case INFO => " [ Info ]"
241
- case FATAL => " [ Fatal ]"
242
- case INTERNAL => " [Internal]"
243
- case DEBUG (_) => " [ Debug ]"
243
+ override protected def severityToPrefix (sev : Severity ): String = " "
244
+
245
+ protected def severityToString (sev : Severity ): String = sev match {
246
+ case ERROR => " error"
247
+ case WARNING => " warning"
248
+ case INFO => " info"
249
+ case FATAL => " fatal"
250
+ case INTERNAL => " internal"
251
+ case DEBUG (_) => " debug"
252
+ }
253
+
254
+ override def emit (msg : Message ) = synchronized {
255
+ if (msg.severity == ERROR || msg.severity == FATAL || msg.severity == INTERNAL )
256
+ println(smartPos(msg.position) + " error: " + msg.msg.toString)
257
+ else if (msg.severity == WARNING )
258
+ println(smartPos(msg.position) + " warning: " + msg.msg.toString)
259
+ else if (msg.severity.isInstanceOf [DEBUG ])
260
+ println(smartPos(msg.position) + " debug: " + msg.msg.toString)
261
+ else
262
+ println(smartPos(msg.position) + msg.msg.toString)
263
+ printLineContent(msg.position, true )
244
264
}
245
265
}
0 commit comments